diff --git a/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContextBuilder.java b/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContextBuilder.java index c6c2ac2c7..83ddd2a1f 100644 --- a/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContextBuilder.java +++ b/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContextBuilder.java @@ -182,7 +182,13 @@ public class VariantContextBuilder { * @param attributes */ public VariantContextBuilder attributes(final Map attributes) { - this.attributes = attributes; + if (attributes != null) { + this.attributes = attributes; + } + else { + this.attributes = new HashMap(); + } + this.attributesCanBeModified = true; return this; } @@ -220,6 +226,7 @@ public class VariantContextBuilder { * Makes the attributes field modifiable. In many cases attributes is just a pointer to an immutable * collection, so methods that want to add / remove records require the attributes to be copied to a */ + @Ensures({"this.attributesCanBeModified"}) private void makeAttributesModifiable() { if ( ! attributesCanBeModified ) { this.attributesCanBeModified = true;