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
This commit is contained in:
JesusFreke@JesusFreke.com 2010-07-29 03:10:18 +00:00
parent 58536878c4
commit 854c577425

View File

@ -66,9 +66,14 @@ public class AnnotationSetItem extends Item<AnnotationSetItem> {
* @return an <code>AnnotationSetItem</code> for the given annotations * @return an <code>AnnotationSetItem</code> for the given annotations
*/ */
public static AnnotationSetItem internAnnotationSetItem(DexFile dexFile, List<AnnotationItem> annotations) { public static AnnotationSetItem internAnnotationSetItem(DexFile dexFile, List<AnnotationItem> annotations) {
AnnotationItem[] annotationsArray = new AnnotationItem[annotations.size()]; AnnotationSetItem annotationSetItem;
annotations.toArray(annotationsArray); if (annotations == null) {
AnnotationSetItem annotationSetItem = new AnnotationSetItem(dexFile, annotationsArray); 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); return dexFile.AnnotationSetsSection.intern(annotationSetItem);
} }