Fix potential NPE in DevelopmentSettingsDashboardFragment

Fix: 364044354
Flag: EXEMPT bugfix
Test: N/A

Change-Id: If4809b44873c620c615696d697a9f2349dbe7890
This commit is contained in:
Jacky Wang
2025-01-23 10:53:11 +08:00
parent f362378c03
commit f29c38b7c5

View File

@@ -198,8 +198,12 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
@Override
public void onChange(boolean selfChange, Uri uri) {
super.onChange(selfChange, uri);
Activity activity = getActivity();
if (activity == null) {
return;
}
final boolean developmentEnabledState =
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(getContext());
DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(activity);
final boolean switchState = mSwitchBar.isChecked();
// when developer options is enabled, but it is disabled by other privilege apps like:
@@ -209,7 +213,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
return;
}
disableDeveloperOptions();
getActivity().runOnUiThread(() -> finishFragment());
activity.runOnUiThread(() -> finishFragment());
}
}
};