From 854c577425a670df02f58552636a471df255aff1 Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Thu, 29 Jul 2010 03:10:18 +0000 Subject: [PATCH] Fix an issue when assembling a file with blank annotation sets git-svn-id: https://smali.googlecode.com/svn/trunk@776 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../main/java/org/jf/dexlib/AnnotationSetItem.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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); }