From 52c6c302770bc727a0a0164cec14ce6faff0841b Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 9 Aug 1999 09:51:12 +0000 Subject: [PATCH] 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 --- jode/jode/bytecode/BytecodeInfo.java.in | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/jode/jode/bytecode/BytecodeInfo.java.in b/jode/jode/bytecode/BytecodeInfo.java.in index 2c49837..5c9fbf3 100644 --- a/jode/jode/bytecode/BytecodeInfo.java.in +++ b/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