From 4789b0c6467eee2928113c97fe03e887ea4032d4 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 22 Jul 2011 17:33:57 +0100 Subject: [PATCH] fix NPE when annotation colourgradient is applied --- src/jalview/appletgui/TreeCanvas.java | 9 ++++++--- src/jalview/gui/TreeCanvas.java | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index a9a4bfe..1cab8d8 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -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, diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index ea78d0f..17830fe 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -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, -- 1.7.10.2