Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bbe0bb4 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Null checks on content resolver query

Bug: 33584356
Test: manual
Change-Id: I05dac1ead1ec1f868f8422d82f245e34a4986ccf
parent b4413f69
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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 {
            if (cursor != null) {
                cursor.close();
            }
            if (DEBUG) Log.d(TAG, "meetsAttendee took " + (System.currentTimeMillis() - start));
        }
    }