fix NPE when annotation colourgradient is applied
[jalview.git] / src / jalview / appletgui / TreeCanvas.java
index a9a4bfe..1cab8d8 100755 (executable)
@@ -623,9 +623,12 @@ public class TreeCanvas extends Panel implements MouseListener,
                   .getWidth(), ColourSchemeProperty.getColourName(av
                   .getGlobalColourScheme()));
         }
-
-        cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
-                av.getIgnoreGapsConsensus());
+        // cs is null if shading is an annotationColourGradient
+        if (cs!=null)
+        {
+          cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
+                  av.getIgnoreGapsConsensus());
+        }
       }
 
       SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,