bugfix
authorjprocter <Jim Procter>
Thu, 19 Apr 2007 16:16:23 +0000 (16:16 +0000)
committerjprocter <Jim Procter>
Thu, 19 Apr 2007 16:16:23 +0000 (16:16 +0000)
src/jalview/datamodel/AlignmentAnnotation.java

index ef9632b..27ccd4c 100755 (executable)
@@ -331,7 +331,10 @@ public class AlignmentAnnotation
   public void restrict(int startRes, int endRes)
   {
     Annotation[] temp = new Annotation[endRes-startRes+1];
-    System.arraycopy(annotations, startRes, temp, 0, endRes-startRes+1);
+    if (startRes<annotations.length) 
+    {
+      System.arraycopy(annotations, startRes, temp, 0, Math.min(endRes, annotations.length-1)-startRes+1);
+    }
     if (sequenceRef!=null) {
       // Clip the mapping, if it exists.
       int spos = sequenceRef.findPosition(startRes);