This commit is contained in:
Alexey Andreev 2015-01-19 18:19:38 +04:00
parent 3f7d02affb
commit 3935d27f5b
2 changed files with 2 additions and 1 deletions

View File

@ -286,7 +286,7 @@ public class Decompiler {
Optimizer optimizer = new Optimizer(); Optimizer optimizer = new Optimizer();
optimizer.optimize(methodNode, method.getProgram()); optimizer.optimize(methodNode, method.getProgram());
methodNode.getModifiers().addAll(mapModifiers(method.getModifiers())); methodNode.getModifiers().addAll(mapModifiers(method.getModifiers()));
int paramCount = method.getSignature().length; int paramCount = Math.min(method.getSignature().length, program.variableCount());
for (int i = 0; i < paramCount; ++i) { for (int i = 0; i < paramCount; ++i) {
Variable var = program.variableAt(i); Variable var = program.variableAt(i);
methodNode.getParameterDebugNames().add(new HashSet<>(var.getDebugNames())); methodNode.getParameterDebugNames().add(new HashSet<>(var.getDebugNames()));

View File

@ -38,6 +38,7 @@ class UnusedVariableEliminator implements ExprVisitor, StatementVisitor {
} }
indexes = new int[variableCount]; indexes = new int[variableCount];
Arrays.fill(indexes, -1); Arrays.fill(indexes, -1);
parameterCount = Math.min(parameterCount, indexes.length - 1);
for (int i = 0; i <= parameterCount; ++i) { for (int i = 0; i <= parameterCount; ++i) {
indexes[i] = lastIndex++; indexes[i] = lastIndex++;
} }