diff --git a/java/src/org/broadinstitute/sting/utils/sam/AlignmentUtils.java b/java/src/org/broadinstitute/sting/utils/sam/AlignmentUtils.java index 0f16de587..399e96e1b 100644 --- a/java/src/org/broadinstitute/sting/utils/sam/AlignmentUtils.java +++ b/java/src/org/broadinstitute/sting/utils/sam/AlignmentUtils.java @@ -722,7 +722,7 @@ public class AlignmentUtils { byte[] alt = new byte[refSeq.length + (indelLength * (indel.getOperator() == CigarOperator.D ? -1 : 1))]; // add the bases before the indel, making sure it's not aligned off the end of the reference - if ( refIndex > alt.length ) + if ( refIndex > alt.length || refIndex > refSeq.length ) return null; System.arraycopy(refSeq, 0, alt, 0, refIndex); int currentPos = refIndex;