Skip to content

Commit

Permalink
Fixed NPE when accessing evt.getNewValue() on properChange-Events.
Browse files Browse the repository at this point in the history
Signed-off-by: weisj <[email protected]>
  • Loading branch information
weisJ committed Mar 5, 2020
1 parent 97a86f9 commit 247690e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public class DarkTableUI extends DarkTableUIBridge {
private final PropertyChangeListener propertyChangeListener = e -> {
String key = e.getPropertyName();
if ("showHorizontalLines".equals(key)) {
boolean b = (boolean) e.getNewValue();
boolean b = Boolean.TRUE.equals(e.getNewValue());
table.setRowMargin(b ? 1 : 0);
} else if ("showVerticalLines".equals(key)) {
boolean b = (boolean) e.getNewValue();
boolean b = Boolean.TRUE.equals(e.getNewValue());
table.getColumnModel().setColumnMargin(b ? 1 : 0);
} else if ("ancestor".equals(key)) {
Object oldVal = e.getOldValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ protected class PropertyChangeHandler implements PropertyChangeListener {
public void propertyChange(final PropertyChangeEvent pce) {
String name = pce.getPropertyName();
if ("title".equals(name)) {
titleLabel.setText(pce.getNewValue().toString());
titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString());
repaint();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ public void propertyChange(final PropertyChangeEvent pce) {
getRootPane().repaint();
}
} else if ("title".equals(name)) {
titleLabel.setText(pce.getNewValue().toString());
titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString());
repaint();
} else if ("componentOrientation".equals(name)) {
revalidate();
Expand All @@ -782,6 +782,7 @@ public void propertyChange(final PropertyChangeEvent pce) {
repaint();
} else if ("background".equals(name) && pce.getNewValue() instanceof Color) {
Color color = (Color) pce.getNewValue();
if (color == null) return;
JNIDecorationsWindows.setBackground(windowHandle, color.getRed(), color.getGreen(), color.getBlue());
}
}
Expand Down

0 comments on commit 247690e

Please sign in to comment.