Fix crash when trying use source sort filter without a pre-selection (#2036)
(cherry picked from commit 1c982c2a01c1bba5ec4a955c9bf61cb346c752e7) # Conflicts: # CHANGELOG.md
This commit is contained in:
parent
6cbbaccaf4
commit
17d225b0d9
@ -188,22 +188,24 @@ private fun FilterItem(filter: Filter<*>, onUpdate: () -> Unit/* SY --> */, star
|
|||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
filter.values.mapIndexed { index, item ->
|
filter.values.mapIndexed { index, item ->
|
||||||
|
val sortAscending = filter.state?.ascending
|
||||||
|
?.takeIf { index == filter.state?.index }
|
||||||
SortItem(
|
SortItem(
|
||||||
label = item,
|
label = item,
|
||||||
sortDescending = filter.state?.ascending?.not()
|
sortDescending = if (sortAscending != null) !sortAscending else null,
|
||||||
?.takeIf { index == filter.state?.index },
|
onClick = {
|
||||||
) {
|
|
||||||
val ascending = if (index == filter.state?.index) {
|
val ascending = if (index == filter.state?.index) {
|
||||||
!filter.state!!.ascending
|
!filter.state!!.ascending
|
||||||
} else {
|
} else {
|
||||||
filter.state!!.ascending
|
filter.state?.ascending ?: true
|
||||||
}
|
}
|
||||||
filter.state = Filter.Sort.Selection(
|
filter.state = Filter.Sort.Selection(
|
||||||
index = index,
|
index = index,
|
||||||
ascending = ascending,
|
ascending = ascending,
|
||||||
)
|
)
|
||||||
onUpdate()
|
onUpdate()
|
||||||
}
|
},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user