From caae4a5f584a2964a669d5c8a5d12a75011732b4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 May 2018 23:12:18 +0200 Subject: [PATCH] fix a crash at trying to delete an event list section --- .../calendar/adapters/EventListAdapter.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt index d68c9174e..026459b96 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListAdapter.kt @@ -189,8 +189,11 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList(selectedPositions.size) selectedPositions.forEach { - eventIds.add((listItems[it] as ListEvent).id) - timestamps.add((listItems[it] as ListEvent).startTS) + val item = listItems[it] + if (item is ListEvent) { + eventIds.add(item.id) + timestamps.add(item.startTS) + } } DeleteEventDialog(activity, eventIds) {