Skip to content

Commit a8eb9cc

Browse files
committed
Fixed exception if mouse position is null
1 parent 0388779 commit a8eb9cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gui/src/main/java/net/raphimc/noteblocktool/frames/ListFrame.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,11 @@ private void addContextMenu() {
173173
contextMenu.addPopupMenuListener(new PopupMenuListener() {
174174
@Override
175175
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
176+
Point mousePosition = contextMenu.getInvoker().getMousePosition();
177+
if (mousePosition == null) return;
178+
176179
int[] selectedRows = ListFrame.this.table.getSelectedRows();
177-
int hoveredRow = ListFrame.this.table.rowAtPoint(contextMenu.getInvoker().getMousePosition());
180+
int hoveredRow = ListFrame.this.table.rowAtPoint(mousePosition);
178181
if (hoveredRow >= 0 && Arrays.stream(selectedRows).noneMatch(i -> i == hoveredRow)) {
179182
ListFrame.this.table.setRowSelectionInterval(hoveredRow, hoveredRow);
180183
}

0 commit comments

Comments
 (0)