Browse Source

Fixed NPE when showing tree cell popup and no cell is targeted. Fixes #194

pull/198/head
weisj 4 years ago
parent
commit
162a6c6b13
  1. 6
      core/src/main/java/com/github/weisj/darklaf/ui/cell/hint/CellHintPopupListener.java

6
core/src/main/java/com/github/weisj/darklaf/ui/cell/hint/CellHintPopupListener.java

@ -90,6 +90,7 @@ public class CellHintPopupListener<T extends JComponent, I> extends MouseInputAd
final boolean isEditing = cellContainer.isEditingCell(index); final boolean isEditing = cellContainer.isEditingCell(index);
final Rectangle allocation = cellContainer.getAllocation(); final Rectangle allocation = cellContainer.getAllocation();
final Rectangle cellBounds = cellContainer.getCellBoundsAt(index, isEditing); final Rectangle cellBounds = cellContainer.getCellBoundsAt(index, isEditing);
if (cellBounds != null && allocation != null) {
final Rectangle visibleBounds = allocation.intersection(cellBounds); final Rectangle visibleBounds = allocation.intersection(cellBounds);
if (visibleBounds.contains(p)) { if (visibleBounds.contains(p)) {
final Component comp = cellContainer.getEffectiveCellRendererComponent(index, isEditing); final Component comp = cellContainer.getEffectiveCellRendererComponent(index, isEditing);
@ -110,9 +111,10 @@ public class CellHintPopupListener<T extends JComponent, I> extends MouseInputAd
lastIndex = index; lastIndex = index;
} }
} }
} else { return;
lastIndex = null;
} }
}
lastIndex = null;
leave(); leave();
} }

Loading…
Cancel
Save