From: Jim Procter Date: Wed, 4 Dec 2024 16:32:33 +0000 (+0000) Subject: JAL-4333 - prophylactically check we have not run out of aligned codons - increase... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fpatch%2FJAL-4333_translatecodonexception;p=jalview.git JAL-4333 - prophylactically check we have not run out of aligned codons - increase width if we have.. --- diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index 9a99b69..a4dc5d0 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -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: