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

Commit efcb4ff2 authored by Shen Lin's avatar Shen Lin
Browse files

Fix NPE when store brightness and displayDevice is null

This issue can cause a phone reboot, we have to make sure displayDevice is not null before getting its unique id.

Bug: 249782095
Test: manual
Change-Id: Iec57f44798820ac741bd2e6843874fb2b1aaef12
parent 6216ab81
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -300,8 +300,11 @@ final class PersistentDataStore {
    }

    public boolean setBrightness(DisplayDevice displayDevice, float brightness) {
        if (displayDevice == null || !displayDevice.hasStableUniqueId()) {
            return false;
        }
        final String displayDeviceUniqueId = displayDevice.getUniqueId();
        if (!displayDevice.hasStableUniqueId() || displayDeviceUniqueId == null) {
        if (displayDeviceUniqueId == null) {
            return false;
        }
        final DisplayState state = getDisplayState(displayDeviceUniqueId, true);