Skip to content

Commit 9466472

Browse files
committed
handle case where ROI is not longer in table
1 parent 727fee5 commit 9466472

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/main/java/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,20 @@ void selectROI(List<Long> roiIDs)
313313
l.add(array[j]);
314314
}
315315
if (roiIDs.size() <= l.size()) table.clearSelection();
316+
// Check the number of rows
317+
int count = table.getModel().getRowCount();
316318
while (i.hasNext()) {
317319
id = i.next();
318320
if (rowIDs.containsKey(id)) {
319321
index = rowIDs.get(id);
320-
if (!l.contains(index)) {
321-
table.addRowSelectionInterval(index, index);
322-
scrollToRow(index);
322+
if (index >= count) {
323+
table.clearSelection();
324+
break;
325+
} else {
326+
if (!l.contains(index)) {
327+
table.addRowSelectionInterval(index, index);
328+
scrollToRow(index);
329+
}
323330
}
324331
}
325332
}

0 commit comments

Comments
 (0)