Fix NPE when adding account but prefManager doesn't exist

Change-Id: Ie7371ba461995bae96ed1d99e224ab7e0d7acc99
Fix: 34219500
Test: make -j40 RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-01-11 10:46:45 -08:00
parent 8116060570
commit 81a030fdfa
2 changed files with 26 additions and 5 deletions

View File

@@ -286,6 +286,9 @@ public class AccountPreferenceController extends PreferenceController
}
private void updateProfileUi(final UserInfo userInfo) {
if (mParent.getPreferenceManager() == null) {
return;
}
final Context context = mContext;
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
@@ -402,6 +405,10 @@ public class AccountPreferenceController extends PreferenceController
}
private void updateAccountTypes(ProfileData profileData) {
if (mParent.getPreferenceManager() == null) {
// This could happen if activity is finishing
return;
}
profileData.preferenceGroup.removeAll();
if (profileData.userInfo.isEnabled()) {
final ArrayList<AccountTypePreference> preferences = getAccountTypePreferences(