Author: dbrosius
Date: Thu Jul 28 03:15:18 2011
New Revision: 1151706
URL: http://svn.apache.org/viewvc?rev=1151706&view=rev
Log:
apply patch: Bug 51565 - [patch] Pass3bVerifier crashes on empty methods
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
URL:
http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java?rev=1151706&r1=1151705&r2=1151706&view=diff
==============================================================================
---
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
(original)
+++
commons/proper/bcel/trunk/src/main/java/org/apache/bcel/verifier/structurals/Pass3bVerifier.java
Thu Jul 28 03:15:18 2011
@@ -252,19 +252,26 @@ public final class Pass3bVerifier extend
//see JVM $4.8.2
//TODO implement all based on stack
Type returnedType = null;
- if( ih.getPrev().getInstruction() instanceof InvokeInstruction
)
- {
- returnedType =
((InvokeInstruction)ih.getPrev().getInstruction()).getType(m.getConstantPool());
- }
- if( ih.getPrev().getInstruction() instanceof LoadInstruction )
- {
- int index =
((LoadInstruction)ih.getPrev().getInstruction()).getIndex();
- returnedType = lvs.get(index);
- }
- if( ih.getPrev().getInstruction() instanceof GETFIELD )
- {
- returnedType =
((GETFIELD)ih.getPrev().getInstruction()).getType(m.getConstantPool());
- }
+ InstructionHandle ihPrev = null;
+ ihPrev = ih.getPrev();
+
+ if (ihPrev != null)
+ {
+ if( ihPrev.getInstruction() instanceof
InvokeInstruction )
+ {
+ returnedType =
((InvokeInstruction)ihPrev.getInstruction()).getType(m.getConstantPool());
+ }
+ if( ihPrev.getInstruction() instanceof LoadInstruction )
+ {
+ int index =
((LoadInstruction)ihPrev.getInstruction()).getIndex();
+ returnedType = lvs.get(index);
+ }
+ if( ihPrev.getInstruction() instanceof GETFIELD )
+ {
+ returnedType =
((GETFIELD)ihPrev.getInstruction()).getType(m.getConstantPool());
+ }
+ }
+
if( returnedType != null )
{
if( returnedType instanceof ObjectType )