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