diff --git a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java index f38638316..6b3de2d65 100644 --- a/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java +++ b/teavm-core/src/main/java/org/teavm/dependency/DependencyGraphBuilder.java @@ -84,7 +84,7 @@ class DependencyGraphBuilder { if (tryCatch.getExceptionType() != null) { exceptions[i] = dependencyChecker.getClassSource().get(tryCatch.getExceptionType()); } - vars[i] = methodDep.getVariable(i); + vars[i] = methodDep.getVariable(tryCatch.getExceptionVariable().getIndex()); } return new ExceptionConsumer(dependencyChecker, exceptions, vars, methodDep); }