From cbf27fdfa69176ee88c5bc8ed229e12135e2839b Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 12 Apr 2020 10:59:40 +0200 Subject: [PATCH] fix the exception type check --- src/de/inetsoftware/jwebassembly/module/BranchManger.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/de/inetsoftware/jwebassembly/module/BranchManger.java b/src/de/inetsoftware/jwebassembly/module/BranchManger.java index 48012bc..ebb9dbf 100644 --- a/src/de/inetsoftware/jwebassembly/module/BranchManger.java +++ b/src/de/inetsoftware/jwebassembly/module/BranchManger.java @@ -932,8 +932,9 @@ class BranchManger { int lineNumber = storeException.getLineNumber(); instructions.add( ++instrPos, storeException.create( VariableOperator.get ) ); - instructions.add( ++instrPos, new WasmConstInstruction( type.getCode(), catchPos, lineNumber ) ); + instructions.add( ++instrPos, new WasmConstInstruction( type.getClassIndex(), catchPos, lineNumber ) ); instructions.add( ++instrPos, new WasmCallInstruction( instanceOf, catchPos, lineNumber, options.types, false ) ); + instructions.add( ++instrPos, new WasmNumericInstruction( NumericOperator.eqz, ValueType.i32, catchPos, lineNumber ) ); instructions.add( ++instrPos, new WasmBlockInstruction( WasmBlockOperator.IF, ValueType.empty, catchPos, lineNumber ) ); instructions.add( ++instrPos, storeException.create( VariableOperator.get ) ); instructions.add( ++instrPos, new WasmBlockInstruction( WasmBlockOperator.THROW, null, catchPos, lineNumber ) );