dont add null group
authoramwaterhouse <Andrew Waterhouse>
Wed, 6 Jul 2005 12:18:25 +0000 (12:18 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 6 Jul 2005 12:18:25 +0000 (12:18 +0000)
src/jalview/appletgui/APopupMenu.java
src/jalview/gui/PopupMenu.java

index 42546f9..cf854b0 100755 (executable)
@@ -296,12 +296,15 @@ public class APopupMenu
   void refresh()\r
   {\r
     SequenceGroup sg = getGroup();\r
-    SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
-    if (superG != null)\r
+    if(sg!=null)\r
     {\r
-      superG.setSuperGroupProperties(sg);\r
-    }\r
+      SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
 \r
+      if (superG != null)\r
+      {\r
+        superG.setSuperGroupProperties(sg);\r
+      }\r
+        }\r
     ap.seqPanel.seqCanvas.repaint();\r
   }\r
 \r
@@ -480,7 +483,8 @@ public class APopupMenu
     SequenceGroup sg = ap.av.getSelectionGroup();\r
 \r
     // this method won't add a new group if it already exists\r
-    ap.av.alignment.addGroup(sg);\r
+    if(sg!=null)\r
+      ap.av.alignment.addGroup(sg);\r
 \r
     return sg;\r
   }\r
index 5ff9ad9..705d407 100755 (executable)
@@ -434,13 +434,15 @@ public class PopupMenu extends JPopupMenu
     void refresh()\r
     {\r
         SequenceGroup sg = getGroup();\r
-        SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
-\r
-        if (superG != null)\r
+        if(sg!=null)\r
         {\r
+          SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
+\r
+          if (superG != null)\r
+          {\r
             superG.setSuperGroupProperties(sg);\r
+          }\r
         }\r
-\r
         ap.seqPanel.repaint();\r
     }\r
 \r
@@ -724,9 +726,9 @@ public class PopupMenu extends JPopupMenu
     SequenceGroup getGroup()\r
     {\r
         SequenceGroup sg = ap.av.getSelectionGroup();\r
-\r
-        // this method won't add a new group if it already exists\r
-        ap.av.alignment.addGroup(sg);\r
+      // this method won't add a new group if it already exists\r
+        if(sg!=null)\r
+          ap.av.alignment.addGroup(sg);\r
 \r
         return sg;\r
     }\r