Skip to content

Commit

Permalink
Merge pull request jboss-javassist#98 from PeterFeicht/master
Browse files Browse the repository at this point in the history
Fix NullPointerException in ControlFlow constructor
  • Loading branch information
chibash authored Sep 17, 2016
2 parents f6992d6 + 2e48e54 commit 0862511
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/javassist/bytecode/analysis/ControlFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ protected BasicBlock[] makeArray(int size) {
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++) {
Expand All @@ -97,6 +99,9 @@ protected BasicBlock[] makeArray(int size) {

/**
* 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;
Expand Down Expand Up @@ -133,7 +138,7 @@ public Frame frameAt(int pos) throws BadBytecode {
* 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()
*/
Expand Down Expand Up @@ -179,7 +184,7 @@ public Node[] dominatorTree() {
* 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()
*/
Expand Down

0 comments on commit 0862511

Please sign in to comment.