mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Prevent AIOOBE in error table
If the error checker updates the table between the click and invocation of the click event listener, selection will be cleared and click index will be -1. Checking if the index is valid before using it.
This commit is contained in:
@@ -105,25 +105,25 @@ public class ErrorTable extends JTable {
|
||||
// }
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
synchronized public void mouseClicked(MouseEvent e) {
|
||||
try {
|
||||
int row = ((ErrorTable) e.getSource()).getSelectedRow();
|
||||
if (row >= 0 && row < getRowCount()) {
|
||||
Object data = getModel().getValueAt(row, DATA_COLUMN);
|
||||
int clickCount = e.getClickCount();
|
||||
if (clickCount == 1) {
|
||||
editor.errorTableClick(data);
|
||||
} else if (clickCount > 1) {
|
||||
editor.errorTableDoubleClick(data);
|
||||
}
|
||||
@Override
|
||||
synchronized public void mouseClicked(MouseEvent e) {
|
||||
try {
|
||||
int row = ((ErrorTable) e.getSource()).getSelectedRow();
|
||||
if (row >= 0 && row < getRowCount()) {
|
||||
Object data = getModel().getValueAt(row, DATA_COLUMN);
|
||||
int clickCount = e.getClickCount();
|
||||
if (clickCount == 1) {
|
||||
editor.errorTableClick(data);
|
||||
} else if (clickCount > 1) {
|
||||
editor.errorTableDoubleClick(data);
|
||||
}
|
||||
// editor.getErrorChecker().scrollToErrorLine(row);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
addMouseMotionListener(new MouseMotionAdapter() {
|
||||
|
||||
Reference in New Issue
Block a user