diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java index b91b906a..ad819db8 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/Program.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/Program.java @@ -902,6 +902,9 @@ public class Program { OpCode op = OpCode.code(code[index]); final byte[] continuedCode; + if (op == null) throw new IllegalOperationException("Invalid operation: " + + Hex.toHexString(code, index, 1)); + switch(op) { case PUSH1: case PUSH2: case PUSH3: case PUSH4: case PUSH5: case PUSH6: case PUSH7: case PUSH8: case PUSH9: case PUSH10: case PUSH11: case PUSH12: case PUSH13: case PUSH14: case PUSH15: case PUSH16: @@ -975,7 +978,13 @@ public class Program { } @SuppressWarnings("serial") - public class IllegalOperationException extends RuntimeException { + public static class IllegalOperationException extends RuntimeException { + public IllegalOperationException(String message) { + super(message); + } + + public IllegalOperationException() { + } } @SuppressWarnings("serial") diff --git a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java index a41338d2..e1cb791a 100644 --- a/ethereumj-core/src/main/java/org/ethereum/vm/VM.java +++ b/ethereumj-core/src/main/java/org/ethereum/vm/VM.java @@ -80,7 +80,7 @@ public class VM { try { OpCode op = OpCode.code(program.getCurrentOp()); if (op == null) - throw program.new IllegalOperationException(); + throw new Program.IllegalOperationException(); program.setLastOp(op.val()); program.stackRequire(op.require());