Browse Source

Fixed NPE in DarkTreeCellRenderer

pull/75/head
weisj 5 years ago
parent
commit
fa3febc143
  1. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRenderer.java

4
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRenderer.java

@ -66,12 +66,12 @@ public class DarkTreeCellRenderer extends DefaultTreeCellRenderer implements Tre
} }
public static Object unwrapBooleanIfPossible(final Object value) { public static Object unwrapBooleanIfPossible(final Object value) {
Object val = value == null ? " " : value; Object val = value;
if (val instanceof DefaultMutableTreeNode) { if (val instanceof DefaultMutableTreeNode) {
val = ((DefaultMutableTreeNode) val).getUserObject(); val = ((DefaultMutableTreeNode) val).getUserObject();
} }
if (!(val instanceof Boolean)) { if (!(val instanceof Boolean)) {
String str = val.toString(); String str = String.valueOf(val);
if ("true".equals(str)) val = true; if ("true".equals(str)) val = true;
if ("false".equals(str)) val = false; if ("false".equals(str)) val = false;
} }

Loading…
Cancel
Save