Skip to content

Commit

Permalink
Fixed `'boolean android.database.Cursor.moveToNext()' on a null objec…
Browse files Browse the repository at this point in the history
…t reference` error

Closes #259
Closes #255
  • Loading branch information
MoOx committed Aug 1, 2020
1 parent 4560a2f commit e7c9680
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions android/src/main/java/com/calendarevents/RNCalendarEvents.java
Expand Up @@ -806,7 +806,7 @@ private void createAttendeesForEvent(ContentResolver resolver, int eventID, Read
Cursor cursor = CalendarContract.Attendees.query(resolver, eventID, new String[] {
CalendarContract.Attendees._ID
});

while (cursor.moveToNext()) {
long attendeeId = cursor.getLong(0);
Uri attendeeUri = ContentUris.withAppendedId(CalendarContract.Attendees.CONTENT_URI, attendeeId);
Expand Down Expand Up @@ -1135,12 +1135,13 @@ private WritableNativeMap serializeEvent(Cursor cursor) {
private WritableNativeArray serializeEventCalendars(Cursor cursor) {
WritableNativeArray results = new WritableNativeArray();

while (cursor.moveToNext()) {
results.pushMap(serializeEventCalendar(cursor));
if (cursor != null) {
while (cursor.moveToNext()) {
results.pushMap(serializeEventCalendar(cursor));
}
cursor.close();
}

cursor.close();

return results;
}

Expand Down

0 comments on commit e7c9680

Please sign in to comment.