Update ArtifactSelectionDialog.java

Fix index out of bounds error
This commit is contained in:
Mark McKinnon 2019-09-18 09:24:38 -04:00
parent 24c68779a7
commit ba24db42ba

View File

@ -110,10 +110,12 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
@Override @Override
public void mousePressed(MouseEvent evt) { public void mousePressed(MouseEvent evt) {
int index = artifactList.locationToIndex(evt.getPoint()); int index = artifactList.locationToIndex(evt.getPoint());
if (index >= 0) {
BlackboardArtifact.Type type = model.getElementAt(index); BlackboardArtifact.Type type = model.getElementAt(index);
artifactTypeSelections.put(type, !artifactTypeSelections.get(type)); artifactTypeSelections.put(type, !artifactTypeSelections.get(type));
artifactList.repaint(); artifactList.repaint();
} }
}
}); });
} }