diff --git a/core/src/main/java/org/teavm/backend/wasm/generate/common/methods/BaseWasmGenerationVisitor.java b/core/src/main/java/org/teavm/backend/wasm/generate/common/methods/BaseWasmGenerationVisitor.java index fccdd8022..592beadb6 100644 --- a/core/src/main/java/org/teavm/backend/wasm/generate/common/methods/BaseWasmGenerationVisitor.java +++ b/core/src/main/java/org/teavm/backend/wasm/generate/common/methods/BaseWasmGenerationVisitor.java @@ -1333,7 +1333,9 @@ public abstract class BaseWasmGenerationVisitor implements StatementVisitor, Exp WasmBlock targetBlock) { var exceptionType = ValueType.object(tryCatch.getExceptionType()); var isMatched = generateInstanceOf(new WasmGetLocal(exceptionVar), exceptionType); - target.add(new WasmBranch(isMatched, targetBlock)); + var br = new WasmBranch(isMatched, targetBlock); + br.setResult(new WasmGetLocal(exceptionVar)); + target.add(new WasmDrop(br)); } private void visitMany(List statements, List target) {