commons-bcel
commons-bcel copied to clipboard
Add null guard for InstructionFactor.createInvoke
In the current implementation of the createInvoke method, an NPE is thrown if the argTypes array is null. This commit adds a null guard that skips the for loop if this is the case.
Example:
public static void main(String args[]) {
InstructionFactory factory= new InstructionFactory(new ClassGen(Repository.lookupClass(Object.class)));
factory.createInvoke("", "", Type.VOID, null, Const.INVOKESPECIAL, false);
}
Exception in thread "main" java.lang.NullPointerException
at org.apache.bcel.generic.InstructionFactory.createInvoke(InstructionFactory.java:643)
at Test.main(Test.java:11)