1
0
mirror of https://github.com/chylex/IntelliJ-Rainbow-Brackets.git synced 2025-05-08 12:34:06 +02:00

Fix cannot create configurable component

(cherry picked from commit 536f92d89b64539e3d7d4501591a97cd4a1d9c5a)
This commit is contained in:
张志豪 2021-01-30 21:59:15 +08:00
parent 2fe50bf08a
commit bc4859c9b6

View File

@ -160,8 +160,8 @@ class RainbowOptionsPanel(
for (i in 0 until minRange()) {
colors[i].isEnabled = rainbowOn
colorLabels[i].isEnabled = rainbowOn
colors[i].selectedColor = descriptions[i].rainbowColor
eventDispatcher.multicaster.selectedOptionChanged(descriptions[i])
colors[i].selectedColor = descriptions.indexOfOrNull(i)?.rainbowColor
descriptions.indexOfOrNull(i)?.let { eventDispatcher.multicaster.selectedOptionChanged(it) }
}
}
@ -257,4 +257,6 @@ class RainbowOptionsPanel(
}
}
}
}
}
private fun <E> List<E>.indexOfOrNull(idx: Int): E? = if (idx < this.size) this[idx] else null