Null check for getServiceInfo
b/11538007
Change-Id: I8b06f22373c3a389939614e9c24bbe143b6fc289
diff --git a/src/com/android/email/activity/setup/AccountSettingsFragment.java b/src/com/android/email/activity/setup/AccountSettingsFragment.java
index 212e007..84e5385 100644
--- a/src/com/android/email/activity/setup/AccountSettingsFragment.java
+++ b/src/com/android/email/activity/setup/AccountSettingsFragment.java
@@ -598,6 +598,10 @@
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 @@
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);