The stored offset is a relative offset from the position of the instruction, not an absolute offset
git-svn-id: https://smali.googlecode.com/svn/trunk@364 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
diff --git a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java
index 424f0b7..d647416 100644
--- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java
+++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java
@@ -218,11 +218,11 @@
if (opcode == Opcode.PACKED_SWITCH) {
Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction(
methodIdItem.getDexFile(), opcode, encodedInstructions, index);
- packedSwitchMap.put(ins.getOffset(), index/2);
+ packedSwitchMap.put(index/2 + ins.getOffset(), index/2);
} else if (opcode == Opcode.SPARSE_SWITCH) {
Instruction31t ins = (Instruction31t)opcode.format.Factory.makeInstruction(
methodIdItem.getDexFile(), opcode, encodedInstructions, index);
- sparseSwitchMap.put(ins.getOffset(), index/2);
+ sparseSwitchMap.put(index/2 + ins.getOffset(), index/2);
}
}