check command.string[i] is not null
authoramwaterhouse <Andrew Waterhouse>
Thu, 26 Oct 2006 12:17:51 +0000 (12:17 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 26 Oct 2006 12:17:51 +0000 (12:17 +0000)
src/jalview/commands/EditCommand.java

index a53798a..125cb93 100644 (file)
@@ -200,11 +200,16 @@ public class EditCommand implements CommandI
 \r
     for(int i=0; i<command.seqs.length; i++)\r
     {\r
-      command.string[i] = command.seqs[i].getSequence(command.position,\r
-                                           command.position + command.number);\r
+      if(command.seqs[i].getLength()>command.position)\r
+      {\r
+        command.string[i] = command.seqs[i].getSequence(command.position,\r
+            command.position + command.number);\r
+\r
+        System.out.println("CUT:"+command.string[i]+":");\r
 \r
-      command.seqs[i].deleteChars(command.position,\r
-                                  command.position+command.number);\r
+        command.seqs[i].deleteChars(command.position,\r
+                                    command.position + command.number);\r
+      }\r
 \r
       if(command.seqs[i].getLength()<1)\r
       {\r
@@ -229,7 +234,8 @@ public class EditCommand implements CommandI
           command.al.addSequence(command.seqs[i]);\r
       }\r
       tmp = new StringBuffer(command.seqs[i].getSequence());\r
-      if(command.string!=null)\r
+\r
+      if(command.string!=null && command.string[i]!=null)\r
       {\r
         tmp.insert(command.position, command.string[i]);\r
         command.string[i] = null;\r