Fix code to pick initial account color
@@ -60,10 +60,10 @@ class AccountCreator(private val preferences: Preferences, private val resources
return accountColors.random()
}
- return availableColors.shuffled().minOf { color ->
+ return availableColors.shuffled().minByOrNull { color ->
val index = DEFAULT_COLORS.indexOf(color)
if (index != -1) index else DEFAULT_COLORS.size
- }
+ } ?: error("availableColors must not be empty")
}
companion object {
