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

Commit d452c75e authored by guangl's avatar guangl Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Fix settings force close in monkey test.

accessPreference.mState null pointer causes settings force close in
monkey test.

Add null pointer protect.

Change-Id: Ia866ac02c8d75308d3ff99f1400f11318f898621
CRs-Fixed: 1069229
parent 08ae3a7d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -212,6 +212,9 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        if (preference instanceof AccessPreference) {
            AccessPreference accessPreference = (AccessPreference) preference;
            if (accessPreference.mState == null) {
                return false;
            }
            boolean whitelisted = newValue == Boolean.TRUE;
            mDataSaverBackend.setIsWhitelisted(accessPreference.mEntry.info.uid,
                    accessPreference.mEntry.info.packageName, whitelisted);