From c202c89f3580eeb8f54e7eefad063939e365f484 Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Wed, 30 Oct 2024 09:38:21 +0100 Subject: [PATCH] Fix Annotation Overlay bug when Dialog was cancelled --- pom.xml | 2 +- .../embl/mobie/lib/bdv/overlay/AnnotatedRegionsOverlay.java | 3 +++ .../mobie/lib/bdv/overlay/AnnotatedSegmentsOrSpotsOverlay.java | 2 +- src/main/java/org/embl/mobie/lib/table/TableView.java | 3 +++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 34ac1a52..10736f35 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.embl.mobie mobie-viewer-fiji - 5.5.1 + 5.5.3 diff --git a/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedRegionsOverlay.java b/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedRegionsOverlay.java index 42f72526..4f258228 100644 --- a/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedRegionsOverlay.java +++ b/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedRegionsOverlay.java @@ -88,6 +88,9 @@ public void close() @Override protected synchronized void draw( Graphics2D g ) { + if ( annotationColumn == null || annotations == null || annotations.isEmpty() ) + return; + if ( viewerTransform != null ) { start = System.currentTimeMillis(); diff --git a/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedSegmentsOrSpotsOverlay.java b/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedSegmentsOrSpotsOverlay.java index 3b9782c2..9a50274f 100644 --- a/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedSegmentsOrSpotsOverlay.java +++ b/src/main/java/org/embl/mobie/lib/bdv/overlay/AnnotatedSegmentsOrSpotsOverlay.java @@ -85,7 +85,7 @@ public void close() @Override protected synchronized void draw( Graphics2D g ) { - if ( annotations == null || annotations.size() == 0 ) + if ( annotationColumn == null || annotations == null || annotations.size() == 0 ) return; if ( viewerTransform != null ) diff --git a/src/main/java/org/embl/mobie/lib/table/TableView.java b/src/main/java/org/embl/mobie/lib/table/TableView.java index 83fe32e1..4cb8112a 100644 --- a/src/main/java/org/embl/mobie/lib/table/TableView.java +++ b/src/main/java/org/embl/mobie/lib/table/TableView.java @@ -497,6 +497,9 @@ private void overlayAnnotationDialog() jTable, "Annotation column" ); + if ( annotationColumn == null ) + return; + if ( annotationOverlay != null ) { annotationOverlay.close();