From ea0989043ab44bb85ff8944765beb903b153f8ea Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Mon, 11 Nov 2013 11:21:46 -0800 Subject: [PATCH] Null check for getServiceInfo b/11538007 Change-Id: I8b06f22373c3a389939614e9c24bbe143b6fc289 --- .../email/activity/setup/AccountSettingsFragment.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/android/email/activity/setup/AccountSettingsFragment.java b/src/com/android/email/activity/setup/AccountSettingsFragment.java index 212e007d6..84e5385ef 100644 --- a/src/com/android/email/activity/setup/AccountSettingsFragment.java +++ b/src/com/android/email/activity/setup/AccountSettingsFragment.java @@ -598,6 +598,10 @@ public class AccountSettingsFragment extends PreferenceFragment activity.runOnUiThread(new Runnable() { @Override public void run() { + if (mInboxNotify == null) { + // Should only happen if we've aborted the settings screen + return; + } mInboxNotify.setChecked( mInboxFolderPreferences.areNotificationsEnabled()); mInboxVibrate.setChecked( @@ -626,6 +630,13 @@ public class AccountSettingsFragment extends PreferenceFragment final String protocol = Account.getProtocol(mContext, mAccount.mId); final EmailServiceInfo info = EmailServiceUtils.getServiceInfo(mContext, protocol); + if (info == null) { + LogUtils.e(Logging.LOG_TAG, "Could not find service info for account " + mAccount.mId + + " with protocol " + protocol); + getActivity().onBackPressed(); + // TODO: put up some sort of dialog here to tell the user something went wrong + return; + } final android.accounts.Account androidAcct = new android.accounts.Account( mAccount.mEmailAddress, info.accountType);