JAL-2665 check for null selection group image
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 5 Sep 2017 14:40:41 +0000 (15:40 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 5 Sep 2017 17:36:09 +0000 (18:36 +0100)
src/jalview/gui/SeqCanvas.java

index 3d8b8aa..d434ba8 100755 (executable)
@@ -437,12 +437,16 @@ public class SeqCanvas extends JComponent implements ViewportListenerI
   public void drawPanelForPrinting(Graphics g1, int startRes, int endRes,
           int startSeq, int endSeq)
   {
+    drawPanel(g1, startRes, endRes, startSeq, endSeq, 0);
+
     BufferedImage selectImage = drawSelectionGroup(startRes, endRes,
             startSeq, endSeq);
-    drawPanel(g1, startRes, endRes, startSeq, endSeq, 0);
-    ((Graphics2D) g1).setComposite(
-            AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
-    g1.drawImage(selectImage, 0, 0, this);
+    if (selectImage != null)
+    {
+      ((Graphics2D) g1).setComposite(AlphaComposite
+              .getInstance(AlphaComposite.SRC_OVER));
+      g1.drawImage(selectImage, 0, 0, this);
+    }
   }
 
   /**