From c28af52e596230e53e910078a8474e19fea6ed57 Mon Sep 17 00:00:00 2001 From: Brian Muramatsu Date: Thu, 28 Jun 2012 14:25:14 -0700 Subject: [PATCH] Fix Settings NPE Labels for account types can be null which causes a NPE to occur in Settings. If the label is null, don't bother adding an account header. If we don't do this, then it would blow up when trying to sort the headers anyway, so this change will fix the crash. Bug 6727947 Change-Id: I284d7204b6d21c8d1b0a36e18ecae2c2361eeb84 --- src/com/android/settings/Settings.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index e8a8f462048..ebbec5dd43f 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -439,6 +439,10 @@ public class Settings extends PreferenceActivity List
accountHeaders = new ArrayList
(accountTypes.length); for (String accountType : accountTypes) { CharSequence label = mAuthenticatorHelper.getLabelForType(this, accountType); + if (label == null) { + continue; + } + Account[] accounts = AccountManager.get(this).getAccountsByType(accountType); boolean skipToAccount = accounts.length == 1 && !mAuthenticatorHelper.hasAccountPreferences(accountType); @@ -689,7 +693,7 @@ public class Settings extends PreferenceActivity mWifiEnabler.resume(); mBluetoothEnabler.resume(); } - + public void pause() { mWifiEnabler.pause(); mBluetoothEnabler.pause();