Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 441ab0ca authored by Aaron Kling's avatar Aaron Kling Committed by Michael Bestas
Browse files

audio: Verify that hal implements get_audio_port before calling

Change-Id: I3652382433d365407bf006d71f36743aa89a76ee
parent 9123dea4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -404,6 +404,10 @@ template <typename HalPort>
Return<void> Device::getAudioPortImpl(const AudioPort& port, getAudioPort_cb _hidl_cb,
                                      int (*halGetter)(audio_hw_device_t*, HalPort*),
                                      const char* halGetterName) {
    if (halGetter == nullptr) {
        _hidl_cb(Result::NOT_SUPPORTED, port);
        return Void();
    }
    HalPort halPort;
    if (status_t status = HidlUtils::audioPortToHal(port, &halPort); status != NO_ERROR) {
        _hidl_cb(analyzeStatus("audioPortToHal", status), port);