Skip to content

Commit

Permalink
Fix NPE in accordion (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
jperedadnr authored Oct 29, 2024
1 parent 44af494 commit 57991f4
Showing 1 changed file with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018 Gluon and/or its affiliates.
* Copyright (c) 2016, 2024, Gluon and/or its affiliates.
* Copyright (c) 2012, 2014, Oracle and/or its affiliates.
* All rights reserved. Use is subject to license terms.
*
Expand Down Expand Up @@ -377,25 +377,16 @@ private void expandedSectionChanged() {
if (!isInspectorLoaded()) {
return;
}
final TitledPane tp;

switch (getExpandedSection()) {
case NONE:
tp = null;
break;
case PROPERTIES:
tp = propertiesTitledPane;
break;
case LAYOUT:
tp = layoutTitledPane;
break;
case CODE:
tp = codeTitledPane;
break;
default:
throw new IllegalStateException("Unexpected section id " + getExpandedSection()); //NOI18N
}

SectionId expandedSection = getExpandedSection();
if (expandedSection == null) {
return;
}
final TitledPane tp = switch (expandedSection) {
case NONE -> null;
case PROPERTIES -> propertiesTitledPane;
case LAYOUT -> layoutTitledPane;
case CODE -> codeTitledPane;
};
accordion.setExpandedPane(tp);
}

Expand Down

0 comments on commit 57991f4

Please sign in to comment.