fix null categories in Settings/Downloads/Exclude

This commit is contained in:
Cuong-Tran 2024-12-13 23:50:00 +07:00
parent 5cc24cca29
commit ed2c214ef3
No known key found for this signature in database
GPG key ID: 733AA7624B9315C2

View file

@ -112,6 +112,14 @@ object SettingsDownloadScreen : SearchableSettings {
return Preference.PreferenceItem.MultiSelectListPreference(
pref = downloadPreferences.removeExcludeCategories(),
title = stringResource(MR.strings.pref_remove_exclude_categories),
subtitleProvider = { v, e ->
val combined = remember(v, e) {
v.map { e[it] }
.takeIf { it.isNotEmpty() }
?.joinToString()
} ?: stringResource(MR.strings.none)
"%s".format(combined)
},
entries = categories()
.associate { it.id.toString() to it.visualName }
.toImmutableMap(),