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

Commit 78bc99e6 authored by chaviw's avatar chaviw
Browse files

Check for null buffer in ColorFade

Screenshot buffers can be null for various reasons so protect against
NPE when taking screenshots

Test: No crash if null buffer
Change-Id: Ie6c47c29227b1c1dc67aeda9a301f4bf3d904e07
parent 3510924a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -493,6 +493,10 @@ final class ColorFade {
                        == Display.COLOR_MODE_DISPLAY_P3;
                SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer =
                        mDisplayManagerInternal.systemScreenshot(mDisplayId);
                if (screenshotBuffer == null) {
                    Slog.e(TAG, "Failed to take screenshot. Buffer is null");
                    return false;
                }
                s.attachAndQueueBufferWithColorSpace(screenshotBuffer.getHardwareBuffer(),
                        screenshotBuffer.getColorSpace());