Merge branch 'bug/JAL-2682parseId' into develop
[jalview.git] / src / jalview / datamodel / Sequence.java
index 1b91ee5..96b0757 100755 (executable)
@@ -82,7 +82,7 @@ public class Sequence extends ASequence implements SequenceI
    */
   int index = -1;
 
-  private SequenceFeatures sequenceFeatureStore;
+  private SequenceFeaturesI sequenceFeatureStore;
 
   /*
    * A cursor holding the approximate current view position to the sequence,
@@ -1844,7 +1844,9 @@ public class Sequence extends ASequence implements SequenceI
      * and we may have included adjacent or enclosing features;
      * remove any that are not enclosing, non-contact features
      */
-    if (endPos > this.end || Comparison.isGap(sequence[toColumn - 1]))
+    boolean endColumnIsGapped = toColumn > 0 && toColumn <= sequence.length
+            && Comparison.isGap(sequence[toColumn - 1]);
+    if (endPos > this.end || endColumnIsGapped)
     {
       ListIterator<SequenceFeature> it = result.listIterator();
       while (it.hasNext())