Merge pull request #5693 from k9mail/fix_pick_color

Fix code to pick initial account color
This commit is contained in:
cketti 2021-09-23 11:23:44 +02:00 committed by GitHub
commit 366d1023ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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 {