fix: out of bounds, test size first

This commit is contained in:
ftbsc 2023-02-08 00:08:58 +01:00
parent 483b111259
commit cf11af60d7

View file

@ -85,13 +85,13 @@ public class PatternMatcher {
if(ignoreLabels && cur.getType() == AbstractInsnNode.LABEL) continue; if(ignoreLabels && cur.getType() == AbstractInsnNode.LABEL) continue;
if(ignoreFrames && cur.getType() == AbstractInsnNode.FRAME) continue; if(ignoreFrames && cur.getType() == AbstractInsnNode.FRAME) continue;
if(ignoreLineNumbers && cur.getType() == AbstractInsnNode.LINE) continue; if(ignoreLineNumbers && cur.getType() == AbstractInsnNode.LINE) continue;
if(predicates.get(match).test(cur)) { if(match == predicates.size()) {
last = cur.getPrevious(); //it was actually the preiovus run in this case
break;
} else if (predicates.get(match).test(cur)) {
match++; match++;
if(first == null) if(first == null)
first = cur; first = cur;
} else if(match == predicates.size()) {
last = cur.getPrevious(); //it was actually the preiovus run in this case
break;
} else break; } else break;
} }
if(first != null && last != null) { if(first != null && last != null) {