fix(gui): additional checks on open search result (#1647)

This commit is contained in:
Skylot
2022-08-18 15:59:45 +01:00
parent ce5d8eeff8
commit 1d7b6fdb2c
@@ -150,11 +150,16 @@ public abstract class CommonSearchDialog extends JFrame {
@Nullable
private JNode getSelectedNode() {
int selectedId = resultsTable.getSelectedRow();
if (selectedId == -1) {
try {
int selectedId = resultsTable.getSelectedRow();
if (selectedId == -1 || selectedId >= resultsTable.getRowCount()) {
return null;
}
return (JNode) resultsModel.getValueAt(selectedId, 0);
} catch (Exception e) {
LOG.error("Failed to get results table selected object", e);
return null;
}
return (JNode) resultsModel.getValueAt(selectedId, 0);
}
@Override