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

Commit 52a02866 authored by Michael W's avatar Michael W Committed by Bruno Martins
Browse files

DevelopmentSettings: Fix possible NPE

* getSystemService() can return null if the service is not
  available
* Check this before accessing a method
* Edge case: This code is usually not called on every device

Change-Id: I722638f2647dde7fb7d6a9a29c4a0e82314231c7
parent 2ebe6058
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -791,7 +791,7 @@ public final class Utils extends com.android.settingslib.Utils {
    static boolean isOemUnlockEnabled(Context context) {
        PersistentDataBlockManager manager =(PersistentDataBlockManager)
                context.getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
        return manager.getOemUnlockEnabled();
        return manager != null && manager.getOemUnlockEnabled();
    }

    /**