summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-04-13 18:36:05 +0200
committer zaaarf <zaaarf@proton.me>2023-04-13 18:36:05 +0200
commit05c9f6c3a2458ecdedbce1468b7a8cd2e0ca2b6f (patch)
treea8dbb037ce1ccb747aa0c55af02cb917d60d3502 /src/main
parentdd09c4f8e1b7e49482a4366b13ae1f9794d3c221 (diff)
fix: nullptr in PatternMatcher
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/lll/tools/PatternMatcher.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main/java/ftbsc/lll/tools/PatternMatcher.java b/src/main/java/ftbsc/lll/tools/PatternMatcher.java
index c5a53a2..ff4423a 100644
--- a/src/main/java/ftbsc/lll/tools/PatternMatcher.java
+++ b/src/main/java/ftbsc/lll/tools/PatternMatcher.java
@@ -83,11 +83,10 @@ public class PatternMatcher {
if(predicates.size() == 0) return new InsnSequence(cur); //match whatever
first = cur;
last = cur;
- for(int match = 0; match < predicates.size(); last = reverse ? last.getPrevious() : last.getNext()) {
+ for(int match = 0; last != null && match < predicates.size(); last = reverse ? last.getPrevious() : last.getNext()) {
if(ignoreLabels && cur.getType() == AbstractInsnNode.LABEL) continue;
if(ignoreFrames && cur.getType() == AbstractInsnNode.FRAME) continue;
if(ignoreLineNumbers && cur.getType() == AbstractInsnNode.LINE) continue;
- if(last == null) break;
if(!predicates.get(match).test(last)) break;
if(match == predicates.size() - 1) {
if(reverse) return new InsnSequence(last, first); //we are matching backwards