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

Commit c1cddb57 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Guard against crash due to null surface

Bug: 77874529
Test: record video, mini CTS
Change-Id: I57c7eabb807196a55bd44948853edc9083529e18
parent 85d2e91d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -6777,9 +6777,14 @@ void ACodec::LoadedState::onSetInputSurface(const sp<AMessage> &msg) {

    sp<RefBase> obj;
    CHECK(msg->findObject("input-surface", &obj));
    if (obj == NULL) {
        ALOGE("[%s] NULL input surface", mCodec->mComponentName.c_str());
        mCodec->mCallback->onInputSurfaceDeclined(BAD_VALUE);
        return;
    }

    sp<PersistentSurface> surface = static_cast<PersistentSurface *>(obj.get());
    mCodec->mGraphicBufferSource = surface->getBufferSource();

    status_t err = setupInputSurface();

    if (err == OK) {