fix: bug in insnsequence creation

This commit is contained in:
zaaarf 2023-03-13 02:21:33 +01:00
parent 850d325ee6
commit 592e38066f
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C

View file

@ -38,8 +38,10 @@ public class InsnSequence extends InsnList {
public InsnSequence(AbstractInsnNode startNode, AbstractInsnNode endNode) { public InsnSequence(AbstractInsnNode startNode, AbstractInsnNode endNode) {
Objects.requireNonNull(startNode); Objects.requireNonNull(startNode);
Objects.requireNonNull(endNode); Objects.requireNonNull(endNode);
for(; startNode != endNode && startNode != null; startNode = startNode.getNext()) for(; startNode != null; startNode = startNode.getNext()) {
this.add(startNode); this.add(startNode);
if(startNode == endNode) break;
}
if(startNode == null) if(startNode == null)
throw new InstructionMismatchException("Nodes" + getFirst() + " and " + getLast() + " are not connected."); throw new InstructionMismatchException("Nodes" + getFirst() + " and " + getLast() + " are not connected.");
} }