avoid crashing at updating search results in some cases, just ignore the update

This commit is contained in:
tibbi 2023-01-14 10:39:21 +01:00
parent 0b23fc3296
commit 65a9600f75
1 changed files with 9 additions and 2 deletions

View File

@ -1226,8 +1226,15 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun showSearchResultEvents(events: ArrayList<Event>, 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<Event>