check if we have any caldav colors before making them distinct

This commit is contained in:
tibbi 2018-05-14 15:37:36 +02:00
parent 6abbc3f43c
commit 6597e1c51a

View File

@ -188,7 +188,9 @@ class CalDAVHandler(val context: Context) {
var sortedColors = ArrayList<Int>(colors.size())
(0 until colors.size()).mapTo(sortedColors) { colors[it] }
sortedColors = sortedColors.distinct() as ArrayList<Int>
if (sortedColors.isNotEmpty()) {
sortedColors = sortedColors.distinct() as ArrayList<Int>
}
return sortedColors
}