diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java index 94b2dfe50..76b84807d 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java @@ -122,10 +122,11 @@ public class ContextCovariate implements StandardCovariate { * @param contextSize context size to use building the context * @return the key representing the context */ - private Long contextWith(byte[] bases, int offset, int contextSize) { + private Long contextWith(final byte[] bases, final int offset, final int contextSize) { Long result = null; - if (offset - contextSize + 1 >= 0) { - final byte[] context = Arrays.copyOfRange(bases, offset - contextSize + 1, offset + 1); + final int start = offset - contextSize + 1; + if (start >= 0) { + final byte[] context = Arrays.copyOfRange(bases, start, offset + 1); if (!BaseUtils.containsBase(context, BaseUtils.N)) result = keyFromContext(context); }