CORPRIV-665: Protect against NPE

This commit is contained in:
Chris Rankin 2017-02-09 16:45:23 +00:00
parent b29235e7cd
commit 6fd9399b20

View File

@ -9,12 +9,12 @@ class CloseableTab(text: String, content: Node) : Tab(text, content) {
fun requestClose() {
val b = behaviour
if (b.canCloseTab(this)) {
if ((b != null) && b.canCloseTab(this)) {
b.closeTab(this)
}
}
private val behaviour: TabPaneBehavior
get() = (tabPane.skin as TabPaneSkin).behavior
private val behaviour: TabPaneBehavior?
get() = (tabPane.skin as TabPaneSkin?)?.behavior
}