Changeset 35730 in osm for applications/viewer


Ignore:
Timestamp:
2021-03-16T18:45:07+01:00 (4 years ago)
Author:
Don-vip
Message:

fix #20557 - NPE (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/checkBoxTree/CheckBoxTree.java

    r34763 r35730  
    44import java.awt.BorderLayout;
    55import java.awt.event.MouseAdapter;
     6import java.util.Objects;
    67
    78import javax.swing.JFrame;
     
    151152        for (int i = 0; i < node.getChildCount(); i++) {
    152153            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())) {
    154159                data(childNode).setSelected(data(node).isSelected());
    155160                setChildrens(childNode, value);
Note: See TracChangeset for help on using the changeset viewer.