From d7df5938b154b6d83c8c2e1c7a6fe47f41797e0d Mon Sep 17 00:00:00 2001 From: "JesusFreke@JesusFreke.com" Date: Sat, 20 Jun 2009 21:59:12 +0000 Subject: [PATCH] Fixed an issue when generating try items at the very end of a method git-svn-id: https://smali.googlecode.com/svn/trunk@185 55b6fa8a-2a1e-11de-a435-ffa8d773f76a --- .../org/jf/baksmali/Adaptors/MethodDefinition.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 8ca4b85a..df36783b 100644 --- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java +++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java @@ -393,7 +393,17 @@ public class MethodDefinition { } //index should never by 0, so this should be safe if (index == instructions.size()) { - index--; + //if the end address is the same as the address of the last instruction, then + //this try item ends at the next to last instruction. + //otherwise, if the end address is past the address of the last instruction, + //thin this try item ends at the last instruction + if (instructions.get(instructions.size() - 1).getOffset() == endAddress) { + //get the address for the next to last instruction + index -= 2; + } else { + //get the address for the last instruction + index--; + } } else { index -= 2; }