DO NOT MERGE - Prevent NPE when account sender name is null

Bug: 3500373
Backport of: Id07270f34d9cc0523c46104b3167711b71798623

Change-Id: I23464e3edd9c8d8ecc54451cf7eabfddb73bd745
This commit is contained in:
Andy Stadler 2011-03-25 16:29:53 -07:00
parent 8f0a79c2ef
commit 9258827315

View File

@ -150,8 +150,11 @@ public class AccountSettings extends PreferenceActivity {
});
mAccountName = (EditTextPreference) findPreference(PREFERENCE_NAME);
mAccountName.setSummary(mAccount.getSenderName());
mAccountName.setText(mAccount.getSenderName());
String senderName = 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() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();