android, desktop: gaurd crashes when item is absent in the list (#6140)

This commit is contained in:
Evgeny authored and GitHub committed 2025-08-01 16:18:55 +01:00
1 parent 9a8ed40082
commit d3a5936d17
6 files changed
+13 -10

No files matched your search

@@ -159,11 +159,11 @@ fun AppearanceScope.AppearanceLayout(
}
}
private fun findEnabledIcon(): AppIcon = AppIcon.values().first { icon ->
private fun findEnabledIcon(): AppIcon = AppIcon.values().firstOrNull { icon ->
androidAppContext.packageManager.getComponentEnabledSetting(
ComponentName(APPLICATION_ID, "chat.simplex.app.MainActivity_${icon.name.lowercase()}")
).let { it == COMPONENT_ENABLED_STATE_DEFAULT || it == COMPONENT_ENABLED_STATE_ENABLED }
}
} ?: AppIcon.DEFAULT
@Preview
@Composable