am 6d1cfd26: Merge "Add some null checks." into jb-ub-mail-ur10

* commit '6d1cfd2630c48c541950ff8625ea751dbf4dc011':
  Add some null checks.
This commit is contained in:
Yu Ping Hu 2013-06-12 11:35:41 -07:00 committed by Android Git Automerger
commit 64b9335421

View File

@ -522,11 +522,16 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
final Cursor accountCursor = mContext.getContentResolver().query(EmailProvider
.uiUri("uiaccount", mAccount.mId), UIProvider.ACCOUNTS_PROJECTION, null,
null, null);
if (accountCursor == null) {
return;
}
com.android.mail.providers.Account account = null;
final com.android.mail.providers.Account account;
try {
if (accountCursor.moveToFirst()) {
account = new com.android.mail.providers.Account(accountCursor);
} else {
return;
}
} finally {
accountCursor.close();
@ -535,11 +540,16 @@ public class AccountSettingsFragment extends EmailPreferenceFragment
final Cursor folderCursor = mContext.getContentResolver().query(
account.settings.defaultInbox, UIProvider.FOLDERS_PROJECTION, null, null,
null);
if (folderCursor == null) {
return;
}
Folder folder = null;
final Folder folder;
try {
if (folderCursor.moveToFirst()) {
folder = new Folder(folderCursor);
} else {
return;
}
} finally {
folderCursor.close();