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,9 +38,11 @@ public class InsnSequence extends InsnList {
public InsnSequence(AbstractInsnNode startNode, AbstractInsnNode endNode) {
Objects.requireNonNull(startNode);
Objects.requireNonNull(endNode);
for(; startNode != endNode && startNode != null; startNode = startNode.getNext())
for(; startNode != null; startNode = startNode.getNext()) {
this.add(startNode);
if (startNode == null)
if(startNode == endNode) break;
}
if(startNode == null)
throw new InstructionMismatchException("Nodes" + getFirst() + " and " + getLast() + " are not connected.");
}