From 7eb0f12ab33d8f49cd7d31ca2966d5bdb1a5eb6f Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 9 Jun 2017 10:58:52 +0100 Subject: [PATCH] JAL-2594 avoid stack trace creating feature on gapped region --- src/jalview/appletgui/APopupMenu.java | 13 ++++++++----- src/jalview/gui/PopupMenu.java | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) 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); + } } } -- 1.7.10.2