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

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

SF: fix a crash in SurfaceFlinger::setActiveModeInternal

Add a null check for the upcoming mode before trying to access it.

Bug: 193760364
Test: fold & unfold device
Change-Id: Ia381db8dd048dcca8fc2535bbb6d668fd32010a9
parent 0957669e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1157,6 +1157,12 @@ void SurfaceFlinger::setActiveModeInternal() {
    }

    const auto upcomingModeInfo = MAIN_THREAD_GUARD(display->getUpcomingActiveMode());
    if (!upcomingModeInfo.mode) {
        // There is no pending mode change. This can happen if the active
        // display changed and the mode change happened on a different display.
        return;
    }

    if (display->getActiveMode()->getSize() != upcomingModeInfo.mode->getSize()) {
        auto& state = mCurrentState.displays.editValueFor(display->getDisplayToken());
        // We need to generate new sequenceId in order to recreate the display (and this