made start and end instruction determination more robust

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1142 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 26 years ago
parent 52c24788fe
commit 52c6c30277
  1. 17
      jode/jode/bytecode/BytecodeInfo.java.in

@ -225,8 +225,21 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
int nameIndex = input.readUnsignedShort();
int typeIndex = input.readUnsignedShort();
int slot = input.readUnsignedShort();
Instruction startInstr = instrs[start];
Instruction endInstr = instrs[end];
Instruction startInstr =
start >= 0 && start < instrs.length ? instrs[start] : null;
Instruction endInstr;
if (end >=0 && end < instrs.length)
endInstr = instrs[end].getPrevByAddr();
else {
endInstr = null;
for (int nr = instrs.length - 1; nr >= 0; nr--) {
if (instrs[nr] != null) {
if (instrs[nr].getNextAddr() == end)
endInstr = instrs[nr];
break;
}
}
}
if (startInstr == null
|| endInstr == null

Loading…
Cancel
Save