watch out for end of seq in findposition
[jalview.git] / src / jalview / datamodel / Sequence.java
index cf578c0..ebdff92 100755 (executable)
@@ -184,10 +184,9 @@ public class Sequence implements SequenceI
     int j   = 0;\r
     int pos = start;\r
 \r
-    while (j < i)\r
+    while (j < i && j<sequence.length())\r
     {\r
       char c = sequence.charAt(j);\r
-\r
       if (!jalview.util.Comparison.isGap((c)))\r
         pos++;\r
 \r