Prevent NPE when account sender name is null

Bug: 3500373
Change-Id: Id07270f34d9cc0523c46104b3167711b71798623
This commit is contained in:
Andy Stadler 2011-03-01 22:19:53 -08:00
parent 37f3385803
commit 2d6a98aedf

View File

@ -381,8 +381,11 @@ public class AccountSettingsFragment extends PreferenceFragment {
);
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().trim();