JAL-4333 - prophylactically check we have not run out of aligned codons - increase... patch/JAL-4333_translatecodonexception
authorJim Procter <jprocter@dundee.ac.uk>
Wed, 4 Dec 2024 16:32:33 +0000 (16:32 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Wed, 4 Dec 2024 16:32:33 +0000 (16:32 +0000)
src/jalview/analysis/Dna.java

index 9a99b69..a4dc5d0 100644 (file)
@@ -590,10 +590,11 @@ public class Dna
         {
           /*
            * Compare this codon's base positions with those currently aligned to
-           * this column in the translation.
+           * this column in the translation. Always check we've not run out of existing aligned codons !
            */
-          final int compareCodonPos = compareCodonPos(alignedCodon,
-                  alignedCodons[aspos]);
+          final int compareCodonPos = (aspos < alignedCodons.length)
+                  ? compareCodonPos(alignedCodon, alignedCodons[aspos])
+                  : -1;
           switch (compareCodonPos)
           {
           case -1: