am 07a85746: Merge "DO NOT MERGE - Prevent NPE when account sender name is null" into gingerbread

* commit '07a85746afecd4267de1fb17f3670b79e06a15f2':
  DO NOT MERGE - Prevent NPE when account sender name is null
This commit is contained in:
Andy Stadler 2011-03-30 09:31:08 -07:00 committed by Android Git Automerger
commit 8252c30599

View File

@ -150,8 +150,11 @@ public class AccountSettings extends PreferenceActivity {
}); });
mAccountName = (EditTextPreference) findPreference(PREFERENCE_NAME); mAccountName = (EditTextPreference) findPreference(PREFERENCE_NAME);
mAccountName.setSummary(mAccount.getSenderName()); String senderName = mAccount.getSenderName();
mAccountName.setText(mAccount.getSenderName()); // In rare cases, sendername will be null; Change this to empty string to avoid NPE's
if (senderName == null) senderName = "";
mAccountName.setSummary(senderName);
mAccountName.setText(senderName);
mAccountName.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { mAccountName.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) { public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString(); final String summary = newValue.toString();