Null checks on content resolver query
Bug: 33584356 Test: manual Change-Id: I05dac1ead1ec1f868f8422d82f245e34a4986ccf
This commit is contained in:
@@ -180,12 +180,12 @@ public class CalendarTracker {
|
||||
final Cursor cursor = mUserContext.getContentResolver().query(Attendees.CONTENT_URI,
|
||||
ATTENDEE_PROJECTION, selection, selectionArgs, null);
|
||||
try {
|
||||
if (cursor.getCount() == 0) {
|
||||
if (cursor == null || cursor.getCount() == 0) {
|
||||
if (DEBUG) Log.d(TAG, "No attendees found");
|
||||
return true;
|
||||
}
|
||||
boolean rt = false;
|
||||
while (cursor.moveToNext()) {
|
||||
while (cursor != null && cursor.moveToNext()) {
|
||||
final long rowEventId = cursor.getLong(0);
|
||||
final String rowEmail = cursor.getString(1);
|
||||
final int status = cursor.getInt(2);
|
||||
@@ -200,7 +200,9 @@ public class CalendarTracker {
|
||||
}
|
||||
return rt;
|
||||
} finally {
|
||||
cursor.close();
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "meetsAttendee took " + (System.currentTimeMillis() - start));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user