diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2016-09-18 02:41:12 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-18 02:41:12 +0900 |
commit | 0862511fae7a9594a5184b4bf65d5b84e12cd7a0 (patch) | |
tree | eceb7da2c630a5b1b97cbf175e346238349c26f2 | |
parent | f6992d66a0d786d8872f5e0754d3270a4728e10c (diff) | |
parent | 2e48e54c0d260b903da3b88a9d3747d9f0df19c8 (diff) | |
download | javassist-0862511fae7a9594a5184b4bf65d5b84e12cd7a0.tar.gz javassist-0862511fae7a9594a5184b4bf65d5b84e12cd7a0.zip |
Merge pull request #98 from PeterFeicht/master
Fix NullPointerException in ControlFlow constructor
-rw-r--r-- | src/main/javassist/bytecode/analysis/ControlFlow.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/javassist/bytecode/analysis/ControlFlow.java b/src/main/javassist/bytecode/analysis/ControlFlow.java index 736299cb..0bf76a3d 100644 --- a/src/main/javassist/bytecode/analysis/ControlFlow.java +++ b/src/main/javassist/bytecode/analysis/ControlFlow.java @@ -71,6 +71,8 @@ public class ControlFlow { return new Block[size]; } }.make(minfo); + if (basicBlocks == null) + basicBlocks = new Block[0]; int size = basicBlocks.length; int[] counters = new int[size]; for (int i = 0; i < size; i++) { @@ -97,6 +99,9 @@ public class ControlFlow { /** * Returns all the basic blocks in the method body. + * + * @return an array of basic blocks, the array has length 0 if + * the method doesn't have code. */ public Block[] basicBlocks() { return basicBlocks; @@ -133,7 +138,7 @@ public class ControlFlow { * For every array element <code>node</code>, its index in the * array is equivalent to <code>node.block().index()</code>. * - * @return an array of the tree nodes, or null if the method is abstract. + * @return an array of the tree nodes, or null if the method doesn't have code. * @see Node#block() * @see Block#index() */ @@ -179,7 +184,7 @@ public class ControlFlow { * For every array element <code>node</code>, its index in the * array is equivalent to <code>node.block().index()</code>. * - * @return an array of the tree nodes, or null if the method is abstract. + * @return an array of the tree nodes, or null if the method doesn't have code. * @see Node#block() * @see Block#index() */ |