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
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-20 21:59:12 +00:00
parent d58edc94c0
commit d7df5938b1

View File

@ -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;
}