Fixed bug in trim right annotation adjust
authoramwaterhouse <Andrew Waterhouse>
Mon, 5 Feb 2007 11:46:11 +0000 (11:46 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 5 Feb 2007 11:46:11 +0000 (11:46 +0000)
src/jalview/commands/EditCommand.java

index 1f60569..7effdfb 100644 (file)
@@ -372,7 +372,12 @@ public class EditCommand implements CommandI
         else\r
         {\r
           if(command.position<aSize)\r
-            temp = new Annotation[aSize - command.number + command.position];\r
+          {\r
+            if (aSize - command.number + command.position > 0)\r
+              temp = new Annotation[aSize - command.number + command.position];\r
+            else\r
+              temp = new Annotation[aSize];\r
+          }\r
           else\r
             temp = new Annotation[aSize];\r
         }\r
@@ -409,7 +414,7 @@ public class EditCommand implements CommandI
         }\r
         else\r
         {\r
-          if(command.position < aSize)\r
+          if(command.position < aSize &&  aSize - command.number+command.position>0)\r
           {\r
             System.arraycopy(annotations[a].annotations,\r
                              0, temp, 0, command.position);\r