Skip to content

Commit 956db78

Browse files
committed
Fix NPE in accordion
1 parent bb3b5bb commit 956db78

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

kit/src/main/java/com/oracle/javafx/scenebuilder/kit/editor/panel/inspector/InspectorPanelController.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2018 Gluon and/or its affiliates.
2+
* Copyright (c) 2016, 2024, Gluon and/or its affiliates.
33
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
44
* All rights reserved. Use is subject to license terms.
55
*
@@ -377,25 +377,16 @@ private void expandedSectionChanged() {
377377
if (!isInspectorLoaded()) {
378378
return;
379379
}
380-
final TitledPane tp;
381-
382-
switch (getExpandedSection()) {
383-
case NONE:
384-
tp = null;
385-
break;
386-
case PROPERTIES:
387-
tp = propertiesTitledPane;
388-
break;
389-
case LAYOUT:
390-
tp = layoutTitledPane;
391-
break;
392-
case CODE:
393-
tp = codeTitledPane;
394-
break;
395-
default:
396-
throw new IllegalStateException("Unexpected section id " + getExpandedSection()); //NOI18N
397-
}
398-
380+
SectionId expandedSection = getExpandedSection();
381+
if (expandedSection == null) {
382+
return;
383+
}
384+
final TitledPane tp = switch (expandedSection) {
385+
case NONE -> null;
386+
case PROPERTIES -> propertiesTitledPane;
387+
case LAYOUT -> layoutTitledPane;
388+
case CODE -> codeTitledPane;
389+
};
399390
accordion.setExpandedPane(tp);
400391
}
401392

0 commit comments

Comments
 (0)