diff --git a/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java b/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java index 15345ebd..e221ad02 100644 --- a/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java +++ b/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java @@ -66,9 +66,14 @@ public class AnnotationSetItem extends Item { * @return an AnnotationSetItem for the given annotations */ public static AnnotationSetItem internAnnotationSetItem(DexFile dexFile, List annotations) { - AnnotationItem[] annotationsArray = new AnnotationItem[annotations.size()]; - annotations.toArray(annotationsArray); - AnnotationSetItem annotationSetItem = new AnnotationSetItem(dexFile, annotationsArray); + AnnotationSetItem annotationSetItem; + if (annotations == null) { + annotationSetItem = new AnnotationSetItem(dexFile, new AnnotationItem[0]); + } else { + AnnotationItem[] annotationsArray = new AnnotationItem[annotations.size()]; + annotations.toArray(annotationsArray); + annotationSetItem = new AnnotationSetItem(dexFile, annotationsArray); + } return dexFile.AnnotationSetsSection.intern(annotationSetItem); }