Fix code to pick initial account color

This commit is contained in:
cketti 2021-09-22 22:00:29 +02:00
parent 1cc41ce69d
commit 9bc32ca37a

View file

@ -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 {