From faa59bd7de3537009f6759b3081066691366d612 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sat, 4 Mar 2023 12:01:39 +0100 Subject: fix: improved InsnSequence --- src/main/java/ftbsc/lll/tools/InsnSequence.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/ftbsc/lll/tools/InsnSequence.java b/src/main/java/ftbsc/lll/tools/InsnSequence.java index 2038155..5932fcd 100644 --- a/src/main/java/ftbsc/lll/tools/InsnSequence.java +++ b/src/main/java/ftbsc/lll/tools/InsnSequence.java @@ -26,7 +26,7 @@ public class InsnSequence extends InsnList { */ public InsnSequence(AbstractInsnNode node) { super(); - super.add(node); + this.add(node); } /** @@ -39,7 +39,7 @@ public class InsnSequence extends InsnList { Objects.requireNonNull(startNode); Objects.requireNonNull(endNode); for(; startNode != endNode && startNode != null; startNode = startNode.getNext()) - super.add(startNode); + this.add(startNode); if (startNode == null) throw new InstructionMismatchException("Nodes" + getFirst() + " and " + getLast() + " are not connected."); } @@ -69,13 +69,14 @@ public class InsnSequence extends InsnList { } /** - * Wraps InsnList's add() to ignore null values. + * Wraps InsnList's add() to throw an exception + * when fed null values. * @param node to add */ @Override public void add(AbstractInsnNode node) { - if(node != null) - super.add(node); + Objects.requireNonNull(node); + super.add(node); } /** -- cgit v1.2.3-56-ga3b1