From 65a9600f7522ff951b19db39e44b18d79ae84bbb Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 14 Jan 2023 10:39:21 +0100 Subject: [PATCH] avoid crashing at updating search results in some cases, just ignore the update --- .../calendar/pro/activities/MainActivity.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt index 2fce6fa83..245ae0317 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/MainActivity.kt @@ -1226,8 +1226,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun showSearchResultEvents(events: ArrayList, updateStatus: Int) { val currentSearchQuery = main_menu.getCurrentQuery() - val filtered = events.filter { - it.title.contains(currentSearchQuery, true) || it.location.contains(currentSearchQuery, true) || it.description.contains(currentSearchQuery, true) + val filtered = try { + events.filter { + it.title.contains(currentSearchQuery, true) || it.location.contains(currentSearchQuery, true) || it.description.contains( + currentSearchQuery, + true + ) + } + } catch (e: ConcurrentModificationException) { + return } searchResultEvents = filtered.toMutableList() as ArrayList