Check for null cursor in EmailPreferenceMigrator#migrate()

b/10456199

Change-Id: I3586fbb1aadbcc7e93208aa35ce948b133737d11
This commit is contained in:
Tony Mantler 2013-08-23 11:31:03 -07:00
parent 3b219ce0bc
commit 21b95c1071

View File

@ -50,6 +50,13 @@ public class EmailPreferenceMigrator extends BasePreferenceMigrator {
final Cursor accountCursor = context.getContentResolver().query(Uri.parse(
EmailContent.CONTENT_URI + "/uiaccts"),
UIProvider.ACCOUNTS_PROJECTION_NO_CAPABILITIES, null, null, null);
if (accountCursor == null) {
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));
@ -57,6 +64,7 @@ public class EmailPreferenceMigrator extends BasePreferenceMigrator {
} finally {
accountCursor.close();
}
}
migrate(context, oldVersion, newVersion, accounts);
}