Fix crash when trying use source sort filter without a pre-selection (#2036)

This commit is contained in:
AntsyLich
2025-04-22 19:02:52 +06:00
committed by GitHub
parent eeab61fc94
commit 1c982c2a01
2 changed files with 17 additions and 14 deletions

View File

@ -44,6 +44,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Fix navigation issue after migrating a duplicated entry from History tab ([@cuong-tran](https://github.com/cuong-tran)) ([#1980](https://github.com/mihonapp/mihon/pull/1980)) - Fix navigation issue after migrating a duplicated entry from History tab ([@cuong-tran](https://github.com/cuong-tran)) ([#1980](https://github.com/mihonapp/mihon/pull/1980))
- Fix duplicate requests in WebView due to empty reasonPhrase ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#2003](https://github.com/mihonapp/mihon/pull/2003)) - Fix duplicate requests in WebView due to empty reasonPhrase ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#2003](https://github.com/mihonapp/mihon/pull/2003))
- Fix content under source browse screen top appbar is interactable ([@AntsyLich](https://github.com/AntsyLich)) ([#2026](https://github.com/mihonapp/mihon/pull/2026)) - Fix content under source browse screen top appbar is interactable ([@AntsyLich](https://github.com/AntsyLich)) ([#2026](https://github.com/mihonapp/mihon/pull/2026))
- Fix crash when trying use source sort filter without a pre-selection ([@AntsyLich](https://github.com/AntsyLich)) ([#2036](https://github.com/mihonapp/mihon/pull/2036))
### Removed ### Removed
- Remove Okhttp networking from WebView Screen ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#2020](https://github.com/mihonapp/mihon/pull/2020)) - Remove Okhttp networking from WebView Screen ([@AwkwardPeak7](https://github.com/AwkwardPeak7)) ([#2020](https://github.com/mihonapp/mihon/pull/2020))

View File

@ -128,22 +128,24 @@ private fun FilterItem(filter: Filter<*>, onUpdate: () -> Unit) {
) { ) {
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 ?: true
filter.state!!.ascending }
} filter.state = Filter.Sort.Selection(
filter.state = Filter.Sort.Selection( index = index,
index = index, ascending = ascending,
ascending = ascending, )
) onUpdate()
onUpdate() },
} )
} }
} }
} }