JAL-2594 avoid stack trace creating feature on gapped region
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 9 Jun 2017 09:58:52 +0000 (10:58 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 9 Jun 2017 09:58:52 +0000 (10:58 +0100)
src/jalview/appletgui/APopupMenu.java
src/jalview/gui/PopupMenu.java

index 77ec373..86610a2 100644 (file)
@@ -836,12 +836,15 @@ public class APopupMenu extends java.awt.PopupMenu implements
         }
       }
 
-      if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
-              features, true, ap))
+      if (!seqs.isEmpty())
       {
-        ap.alignFrame.sequenceFeatures.setState(true);
-        ap.av.setShowSequenceFeatures(true);
-        ap.highlightSearchResults(null);
+        if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs,
+                features, true, ap))
+        {
+          ap.alignFrame.sequenceFeatures.setState(true);
+          ap.av.setShowSequenceFeatures(true);
+          ap.highlightSearchResults(null);
+        }
       }
     }
     else
index 9a6c760..756b77b 100644 (file)
@@ -1944,11 +1944,17 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
       }
     }
 
-    if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
-            features, true, ap))
+    /*
+     * an entirely gapped region will generate empty lists of sequence / features
+     */
+    if (!seqs.isEmpty())
     {
-      ap.alignFrame.setShowSeqFeatures(true);
-      ap.highlightSearchResults(null);
+      if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(
+              seqs, features, true, ap))
+      {
+        ap.alignFrame.setShowSeqFeatures(true);
+        ap.highlightSearchResults(null);
+      }
     }
   }