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

Commit 4219c290 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Update 'indexOfKey' return check

Method 'indexOfKey' will return 'NAME_NOT_FOUND' error
status in case it doesn't find any values matching the
given key. Checking for anything other than this error
code could lead to instabilities.

Bug: 35925482
Test: Manual using application
Change-Id: Ie72eb29776b27a6d485f6e42ee7e62c62795ca9e
parent f71a3c25
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -967,7 +967,7 @@ void Camera3Device::processOneCaptureResult(
        const StreamBuffer &bSrc = result.outputBuffers[i];

        ssize_t idx = mOutputStreams.indexOfKey(bSrc.streamId);
        if (idx == -1) {
        if (idx == NAME_NOT_FOUND) {
            ALOGE("%s: Frame %d: Buffer %zu: Invalid output stream id %d",
                    __FUNCTION__, result.frameNumber, i, bSrc.streamId);
            return;
@@ -1053,7 +1053,7 @@ void Camera3Device::notify(
            m.message.error.frame_number = msg.msg.error.frameNumber;
            if (msg.msg.error.errorStreamId >= 0) {
                ssize_t idx = mOutputStreams.indexOfKey(msg.msg.error.errorStreamId);
                if (idx == -1) {
                if (idx == NAME_NOT_FOUND) {
                    ALOGE("%s: Frame %d: Invalid error stream id %d",
                            __FUNCTION__, m.message.error.frame_number, msg.msg.error.errorStreamId);
                    return;