Skip to content

Commit f5783d1

Browse files
committed
🐛 Short circuit empty calendars list
1 parent cd2237f commit f5783d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/IO/EventRepo.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ final class EventRepo {
6565
eventStore.refreshSourcesIfNecessary()
6666

6767
let calendars = fetchEkCalendars(filter: calendarFilter)
68+
// an emoty list means, no valid selection, but unfortunately the api for
69+
// eventStore.predicateForEvents treats nil and an emptyList as a means
70+
// to retrieve all calendars, so we short circuit
71+
if calendars.isEmpty {
72+
return []
73+
}
6874

6975
let predicate = eventStore.predicateForEvents(
7076
withStart: start,

0 commit comments

Comments
 (0)