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

Commit a6ca0acf authored by Igor Murashkin's avatar Igor Murashkin Committed by Android Git Automerger
Browse files

am bd3e2e03: camera2: Fix segfault when using null availability listener

* commit 'bd3e2e03':
  camera2: Fix segfault when using null availability listener
parents 8788c40c bd3e2e03
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -655,6 +655,11 @@ status_t CameraService::addListener(
                                const sp<ICameraServiceListener>& listener) {
    ALOGV("%s: Add listener %p", __FUNCTION__, listener.get());

    if (listener == 0) {
        ALOGE("%s: Listener must not be null", __FUNCTION__);
        return BAD_VALUE;
    }

    Mutex::Autolock lock(mServiceLock);

    Vector<sp<ICameraServiceListener> >::iterator it, end;
@@ -683,6 +688,11 @@ status_t CameraService::removeListener(
                                const sp<ICameraServiceListener>& listener) {
    ALOGV("%s: Remove listener %p", __FUNCTION__, listener.get());

    if (listener == 0) {
        ALOGE("%s: Listener must not be null", __FUNCTION__);
        return BAD_VALUE;
    }

    Mutex::Autolock lock(mServiceLock);

    Vector<sp<ICameraServiceListener> >::iterator it;