From 5a031e85d29cfea87af2b567a079629f1af882d5 Mon Sep 17 00:00:00 2001 From: Roman Birg Date: Wed, 11 Mar 2015 13:00:23 -0700 Subject: Settings: fix potential NPE when resetting profiles When the user hits the positive button in the confirmation dialog to reset profiles, we force a refresh of the profiles list. This can lead to a NPE exception being thrown if it happens before the dialog actually gets dismissed (and the ProfilesList fragment is actually attached) since the reload list calls getPreferenceScreen(), which can be null, since it is not attached. After the dialog disappears, onResume() gets called in ProfilesList anyways, so there's no need for a forced refresh. Change-Id: I93de7115a69cc7545bf6a33de3a4abf5443658b9 Signed-off-by: Roman Birg --- src/com/android/settings/profiles/ProfilesSettings.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/com/android/settings/profiles') diff --git a/src/com/android/settings/profiles/ProfilesSettings.java b/src/com/android/settings/profiles/ProfilesSettings.java index e03cc53..ed12663 100644 --- a/src/com/android/settings/profiles/ProfilesSettings.java +++ b/src/com/android/settings/profiles/ProfilesSettings.java @@ -210,7 +210,6 @@ public class ProfilesSettings extends SettingsPreferenceFragment { @Override public void onClick(DialogInterface dialog, int id) { mProfileManager.resetAll(); - mAdapter.refreshProfiles(); mProfileManager.setActiveProfile( mProfileManager.getActiveProfile().getUuid()); } -- cgit v1.1