am 99ee8eb0: Merge "Null check for getServiceInfo" into jb-ub-mail-ur10

* commit '99ee8eb04418ee4797082770f34ada6f96d36bd7':
  Null check for getServiceInfo
This commit is contained in:
Yu Ping Hu 2013-11-12 11:07:59 -08:00 committed by Android Git Automerger
commit cb7fcefde8

View File

@ -598,6 +598,10 @@ public class AccountSettingsFragment extends PreferenceFragment
activity.runOnUiThread(new Runnable() { activity.runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mInboxNotify == null) {
// Should only happen if we've aborted the settings screen
return;
}
mInboxNotify.setChecked( mInboxNotify.setChecked(
mInboxFolderPreferences.areNotificationsEnabled()); mInboxFolderPreferences.areNotificationsEnabled());
mInboxVibrate.setChecked( mInboxVibrate.setChecked(
@ -626,6 +630,13 @@ public class AccountSettingsFragment extends PreferenceFragment
final String protocol = Account.getProtocol(mContext, mAccount.mId); final String protocol = Account.getProtocol(mContext, mAccount.mId);
final EmailServiceInfo info = EmailServiceUtils.getServiceInfo(mContext, protocol); 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( final android.accounts.Account androidAcct = new android.accounts.Account(
mAccount.mEmailAddress, info.accountType); mAccount.mEmailAddress, info.accountType);