If alignment is closed, then undo performed in visible window
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index 844c1ab..315b141 100755 (executable)
@@ -108,7 +108,6 @@ public class AnnotationPanel extends JPanel implements MouseListener,
     public int adjustPanelHeight()\r
     {\r
         // setHeight of panels\r
-        image = null;\r
         AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
         int height = 0;\r
 \r
@@ -509,12 +508,17 @@ public class AnnotationPanel extends JPanel implements MouseListener,
             }\r
         }\r
 \r
+        if(row==-1)\r
+          return;\r
+\r
         int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
 \r
         if(av.hasHiddenColumns)\r
           res = av.getColumnSelection().adjustForHiddenColumns(res);\r
 \r
-        if (row > -1 && res<aa[row].annotations.length)\r
+        if ( aa[row].annotations!=null\r
+             && row > -1\r
+             && res < (int) aa[row].annotations.length)\r
         {\r
             if(aa[row].graphGroup>-1)\r
             {\r
@@ -654,6 +658,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
     {\r
       if(av.updatingConsensus || av.updatingConservation)\r
       {\r
+        if(image==null)\r
+         {\r
+           return;\r
+         }\r
         //We'll keep a record of the old image,\r
         //and draw a faded image until the calculation\r
         //has completed\r