Check for null activity before getting dashboard categories.
In DashboardSummary, when async task finishes running, ensure that the fragment is still associated with the activity before getting the dashboard categories from the activity. Change-Id: If23cd27a0d3e3429d900ae41ef6f24ed03b9e8d6 Fixes: 30278854
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.dashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@@ -231,8 +232,12 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(List<Tile> tiles) {
|
||||
final Activity activity = getActivity();
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
List<DashboardCategory> categories =
|
||||
((SettingsActivity) getActivity()).getDashboardCategories();
|
||||
((SettingsActivity) activity).getDashboardCategories();
|
||||
mAdapter.setCategoriesAndSuggestions(categories, tiles);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user