From: gmungoc Date: Fri, 9 Jun 2017 09:58:52 +0000 (+0100) Subject: JAL-2594 avoid stack trace creating feature on gapped region X-Git-Tag: Release_2_10_3b1~132^2~11^2^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7eb0f12ab33d8f49cd7d31ca2966d5bdb1a5eb6f;p=jalview.git JAL-2594 avoid stack trace creating feature on gapped region --- diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 77ec373..86610a2 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -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 diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 9a6c760..756b77b 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -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); + } } }