mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Fix crash when reducing empty collection
This commit is contained in:
parent
647a066c90
commit
ab6220a4cb
1 changed files with 6 additions and 2 deletions
|
@ -51,7 +51,9 @@ class HomeDetailViewModel(initialState: HomeDetailViewState,
|
|||
val peopleNotifications = summaries
|
||||
.filter { it.isDirect }
|
||||
.map { it.notificationCount }
|
||||
.reduce { acc, i -> acc + i }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.reduce { acc, i -> acc + i }
|
||||
?: 0
|
||||
val peopleHasHighlight = summaries
|
||||
.filter { it.isDirect }
|
||||
.any { it.highlightCount > 0 }
|
||||
|
@ -59,7 +61,9 @@ class HomeDetailViewModel(initialState: HomeDetailViewState,
|
|||
val roomsNotifications = summaries
|
||||
.filter { !it.isDirect }
|
||||
.map { it.notificationCount }
|
||||
.reduce { acc, i -> acc + i }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.reduce { acc, i -> acc + i }
|
||||
?: 0
|
||||
val roomsHasHighlight = summaries
|
||||
.filter { !it.isDirect }
|
||||
.any { it.highlightCount > 0 }
|
||||
|
|
Loading…
Reference in a new issue