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

@ -54,7 +54,7 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
/**
* Creates new form ArtifactSelectionDialog
*
*
* @param parent The parent window
* @param modal Block user-input to other top-level windows.
*/
@ -110,9 +110,11 @@ public class ArtifactSelectionDialog extends javax.swing.JDialog {
@Override
public void mousePressed(MouseEvent evt) {
int index = artifactList.locationToIndex(evt.getPoint());
BlackboardArtifact.Type type = model.getElementAt(index);
artifactTypeSelections.put(type, !artifactTypeSelections.get(type));
artifactList.repaint();
if (index >= 0) {
BlackboardArtifact.Type type = model.getElementAt(index);
artifactTypeSelections.put(type, !artifactTypeSelections.get(type));
artifactList.repaint();
}
}
});
}