]> source.dussan.org Git - javassist.git/commitdiff
for fixing JIRA-95
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Mon, 19 Oct 2009 06:07:45 +0000 (06:07 +0000)
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Mon, 19 Oct 2009 06:07:45 +0000 (06:07 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@499 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

src/main/javassist/bytecode/stackmap/MapMaker.java

index ab5c863adafbef17e881c1248ec9f8d768ad2786..6d2bf6858e88ee04e2a188d4002714608e4b9070 100644 (file)
@@ -467,7 +467,7 @@ public class MapMaker extends Tracer {
 
     public StackMap toStackMap2(ConstPool cp, TypedBlock[] blocks) {
         StackMap.Writer writer = new StackMap.Writer();
-        int n = blocks.length;
+        int n = blocks.length;      // should be > 0
         boolean[] effective = new boolean[n];
         TypedBlock prev = blocks[0];
 
@@ -483,7 +483,10 @@ public class MapMaker extends Tracer {
                 num++;
             }
         }
-            
+
+        if (num == 0)
+            return null;
+
         writer.write16bit(num);
         for (int i = 0; i < n; i++)
             if (effective[i])