am 21b95c10: Check for null cursor in EmailPreferenceMigrator#migrate()

* commit '21b95c1071b15a8c264c945a809d60ee284020de':
  Check for null cursor in EmailPreferenceMigrator#migrate()
This commit is contained in:
Tony Mantler 2013-08-23 11:46:35 -07:00 committed by Android Git Automerger
commit 14e4ee0be3

View File

@ -50,12 +50,20 @@ public class EmailPreferenceMigrator extends BasePreferenceMigrator {
final Cursor accountCursor = context.getContentResolver().query(Uri.parse( final Cursor accountCursor = context.getContentResolver().query(Uri.parse(
EmailContent.CONTENT_URI + "/uiaccts"), EmailContent.CONTENT_URI + "/uiaccts"),
UIProvider.ACCOUNTS_PROJECTION_NO_CAPABILITIES, null, null, null); UIProvider.ACCOUNTS_PROJECTION_NO_CAPABILITIES, null, null, null);
try {
while (accountCursor.moveToNext()) { if (accountCursor == null) {
accounts.add(new Account(accountCursor)); LogUtils.wtf(LOG_TAG,
"Null cursor returned from query to %s when migrating accounts from %d to %d",
EmailContent.CONTENT_URI + "/uiaccts",
oldVersion, newVersion);
} else {
try {
while (accountCursor.moveToNext()) {
accounts.add(new Account(accountCursor));
}
} finally {
accountCursor.close();
} }
} finally {
accountCursor.close();
} }
migrate(context, oldVersion, newVersion, accounts); migrate(context, oldVersion, newVersion, accounts);