From 9466472925265b0b02b7c054c55d62705a9b8215 Mon Sep 17 00:00:00 2001 From: Jean-Marie Burel Date: Sun, 6 Aug 2023 01:39:56 +0100 Subject: [PATCH] handle case where ROI is not longer in table --- .../agents/measurement/view/ServerROITable.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java b/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java index b5adf3afe..63a0d19b6 100644 --- a/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java +++ b/src/main/java/org/openmicroscopy/shoola/agents/measurement/view/ServerROITable.java @@ -313,13 +313,20 @@ void selectROI(List roiIDs) l.add(array[j]); } if (roiIDs.size() <= l.size()) table.clearSelection(); + // Check the number of rows + int count = table.getModel().getRowCount(); while (i.hasNext()) { id = i.next(); if (rowIDs.containsKey(id)) { index = rowIDs.get(id); - if (!l.contains(index)) { - table.addRowSelectionInterval(index, index); - scrollToRow(index); + if (index >= count) { + table.clearSelection(); + break; + } else { + if (!l.contains(index)) { + table.addRowSelectionInterval(index, index); + scrollToRow(index); + } } } }