diff --git a/src/main/java/org/broad/igv/feature/Exon.java b/src/main/java/org/broad/igv/feature/Exon.java index d23b38dab..a19521dc5 100644 --- a/src/main/java/org/broad/igv/feature/Exon.java +++ b/src/main/java/org/broad/igv/feature/Exon.java @@ -229,12 +229,14 @@ private void computeAminoAcidSequence(Genome genome, Exon prevExon, Exon nextExo // Grab nucleotides from next exon if needed for last codon int phase = (3 - readingFrame) % 3; int diff = 3 - ((readEnd - (codingStart + phase)) % 3); - if (diff > 0 && nextExon != null) { + if (diff > 0 && diff < 3 && nextExon != null && !nextExon.isNonCoding()) { byte[] d = genome.getSequence(chr, nextExon.getCdStart(), nextExon.getCdStart() + diff); - byte[] tmp = new byte[d.length + seqBytes.length]; - System.arraycopy(seqBytes, 0, tmp, 0, seqBytes.length); - System.arraycopy(d, 0, tmp, seqBytes.length, d.length); - seqBytes = tmp; + if(d != null) { + byte[] tmp = new byte[d.length + seqBytes.length]; + System.arraycopy(seqBytes, 0, tmp, 0, seqBytes.length); + System.arraycopy(d, 0, tmp, seqBytes.length, d.length); + seqBytes = tmp; + } } } else {