From 1778cdd563831459f049be5864f04581c2f32187 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 9 Jun 2022 11:20:22 +0100 Subject: [PATCH] JAL-4026 ignore StructureSelectionManager events if no viewer is available to act on them --- src/jalview/structures/models/AAStructureBindingModel.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index 44d698d..906cb59 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -20,8 +20,6 @@ */ package jalview.structures.models; -import java.util.Locale; - import java.awt.Color; import java.io.File; import java.io.IOException; @@ -31,6 +29,7 @@ import java.util.BitSet; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import javax.swing.SwingUtilities; @@ -1280,6 +1279,12 @@ public abstract class AAStructureBindingModel @Override public void updateColours(Object source) { + if (getViewer() == null) + { + // can happen if a viewer was not instantiated or cleaned up and is still + // registered - mostly during tests + return; + } AlignmentViewPanel ap = (AlignmentViewPanel) source; // ignore events from panels not used to colour this view if (!getViewer().isUsedForColourBy(ap)) -- 1.7.10.2