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
diff --git a/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java b/dexlib/src/main/java/org/jf/dexlib/AnnotationSetItem.java
index 15345eb..e221ad0 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 @@
      * @return an <code>AnnotationSetItem</code> for the given annotations
      */
     public static AnnotationSetItem internAnnotationSetItem(DexFile dexFile, List<AnnotationItem> 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);
     }