From 3f848bf2699737ea0daea99f4b5d2b68e09da06b Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 4 Dec 2024 16:32:33 +0000 Subject: [PATCH] JAL-4333 - prophylactically check we have not run out of aligned codons - increase width if we have.. --- src/jalview/analysis/Dna.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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: -- 1.7.10.2