diff --git a/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java b/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java
index a8f32d5..261a15e 100644
a
|
b
|
package org.openstreetmap.gui.jmapviewer.checkBoxTree;
|
3 | 3 | |
4 | 4 | import java.awt.BorderLayout; |
5 | 5 | import java.awt.event.MouseAdapter; |
| 6 | import java.util.Objects; |
6 | 7 | |
7 | 8 | import javax.swing.JFrame; |
8 | 9 | import javax.swing.JScrollPane; |
… |
… |
public class CheckBoxTree extends JTree {
|
150 | 151 | private static void setChildrens(DefaultMutableTreeNode node, Boolean value) { |
151 | 152 | for (int i = 0; i < node.getChildCount(); i++) { |
152 | 153 | DefaultMutableTreeNode childNode = node(node.getChildAt(i)); |
153 | | if (!data(childNode).isSelected().equals(data(node).isSelected())) { |
| 154 | // Fix NPE from #20557 |
| 155 | final CheckBoxNodeData childData = data(childNode); |
| 156 | final CheckBoxNodeData nodeData = data(node); |
| 157 | if (childData != null && nodeData != null && |
| 158 | !Objects.equals(childData.isSelected(), nodeData.isSelected())) { |
154 | 159 | data(childNode).setSelected(data(node).isSelected()); |
155 | 160 | setChildrens(childNode, value); |
156 | 161 | } |