fix NPE when annotation colourgradient is applied
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 22 Jul 2011 16:33:57 +0000 (17:33 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 22 Jul 2011 16:33:57 +0000 (17:33 +0100)
src/jalview/appletgui/TreeCanvas.java
src/jalview/gui/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,
index ea78d0f..17830fe 100755 (executable)
@@ -905,9 +905,12 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
                   .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, null, cs, true, true,