Fix crash when set theme not in use no longer exists

This commit is contained in:
Jays2Kings 2021-07-05 23:40:04 -04:00
parent 490b467ed2
commit da76d4854f

View File

@ -99,18 +99,7 @@ class SettingsGeneralController : SettingsController() {
titleRes = R.string.app_theme
lastScrollPostionLight = lastThemeXLight
lastScrollPostionDark = lastThemeXDark
summary = if (preferences.nightMode()
.get() == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
) {
val lightTheme = preferences.lightTheme().get().nameRes
val darkTheme = preferences.darkTheme().get().nameRes
val nightMode = context.isInNightMode()
mutableListOf(context.getString(lightTheme), context.getString(darkTheme)).apply {
if (nightMode) reverse()
}.joinToString(" / ")
} else {
context.getString(context.getPrefTheme(preferences).nameRes)
}
summary = context.getString(context.getPrefTheme(preferences).nameRes)
activity = this@SettingsGeneralController.activity
}