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

Commit fd41b424 authored by Jason Monk's avatar Jason Monk
Browse files

Protect against monkey crash

When rebuild comes in after context is no longer valid

Change-Id: Ib64e93372bff4c6b0e1232ac257f3df0e9d0be0a
Fixes: 28875397
parent 77ad3c25
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment

    @Override
    public void onRebuildComplete(ArrayList<AppEntry> apps) {
        if (getContext() == null) return;
        cacheRemoveAllPrefs(getPreferenceScreen());
        final int N = apps.size();
        for (int i = 0; i < N; i++) {
@@ -159,7 +160,7 @@ public class UnrestrictedDataAccess extends SettingsPreferenceFragment
            String key = entry.info.packageName + "|" + entry.info.uid;
            AccessPreference preference = (AccessPreference) getCachedPreference(key);
            if (preference == null) {
                preference = new AccessPreference(getContext(), entry);
                preference = new AccessPreference(getPrefContext(), entry);
                preference.setKey(key);
                preference.setOnPreferenceChangeListener(this);
                getPreferenceScreen().addPreference(preference);