NPE protection for invokeJobRecheck() in the fragment
Ensure getContext() is not null before invokeJobRecheck() in the background, since the main fragment may be detached to return null context (in the corner case) Test: atest Fix: 331719252 Change-Id: Ia7ba757d2e6ebaf3fd371af51270c0eb0ad0a9f7
This commit is contained in:
@@ -95,7 +95,11 @@ public class PowerUsageAdvanced extends PowerUsageBase {
|
||||
super.onCreate(icicle);
|
||||
mHistPref = findPreference(KEY_BATTERY_CHART);
|
||||
setBatteryChartPreferenceController();
|
||||
AsyncTask.execute(() -> BootBroadcastReceiver.invokeJobRecheck(getContext()));
|
||||
AsyncTask.execute(() -> {
|
||||
if (getContext() != null) {
|
||||
BootBroadcastReceiver.invokeJobRecheck(getContext());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user