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

Commit fdf1bffc authored by Ady Abraham's avatar Ady Abraham
Browse files

SurfaceFlinger: check for nullptr on setFrameTimelineVsync

Make sure that the layer still exists before trying to set
the vsync id for it.

Bug: 169577113
Test: manual
Change-Id: I4a0661adb7fc42476bfaf9d1c9f43999763d4c40
parent efcea5a8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6189,6 +6189,11 @@ status_t SurfaceFlinger::setFrameTimelineVsync(const sp<IGraphicBufferProducer>&
    }

    sp<Layer> layer = (static_cast<MonitoredProducer*>(surface.get()))->getLayer();
    if (layer == nullptr) {
        ALOGE("Attempt to set frame timeline vsync on a layer that no longer exists");
        return BAD_VALUE;
    }

    layer->setFrameTimelineVsync(frameTimelineVsyncId);
    return NO_ERROR;
}