catch control down before editing null pointer
[jalview.git] / src / jalview / appletgui / SeqPanel.java
index 7933eb9..6c1a619 100755 (executable)
@@ -522,12 +522,16 @@ public class SeqPanel
 \r
     if (seq >= av.getAlignment().getHeight() || seq<0 || res<0)\r
     {\r
+      if(tooltip!=null)\r
+        tooltip.setTip("");\r
       return;\r
     }\r
 \r
     SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
     if (res > sequence.getLength())\r
     {\r
+      if(tooltip!=null)\r
+        tooltip.setTip("");\r
       return;\r
     }\r
 \r
@@ -616,9 +620,6 @@ public class SeqPanel
       tooltip = new Tooltip(tooltipText.toString(), seqCanvas);\r
     else\r
       tooltip.setTip(tooltipText.toString());\r
-\r
-    tooltip.repaint();\r
-\r
   }\r
 \r
   Vector getAllFeaturesAtRes(SequenceI seq, int res)\r
@@ -790,6 +791,13 @@ public class SeqPanel
         //but the sequence represents a group\r
         if (sg == null)\r
         {\r
+          if (av.hiddenRepSequences == null\r
+              || !av.hiddenRepSequences.containsKey(seq))\r
+          {\r
+            endEditing();\r
+            return;\r
+          }\r
+\r
           sg = (SequenceGroup) av.hiddenRepSequences.get(seq);\r
         }\r
 \r