forked from GitHub-Mirror/riotX-android
Fix crash when reducing empty collection
This commit is contained in:
parent
647a066c90
commit
ab6220a4cb
@ -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 New Issue
Block a user