From: Jim Procter Date: Thu, 9 Jun 2022 10:20:22 +0000 (+0100) Subject: JAL-4026 ignore StructureSelectionManager events if no viewer is available to act... X-Git-Tag: Release_2_11_2_6~56 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1778cdd563831459f049be5864f04581c2f32187;p=jalview.git JAL-4026 ignore StructureSelectionManager events if no viewer is available to act on them --- 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))