Skip to content

Commit

Permalink
Fix IndexOutOfBoundsException (#198)
Browse files Browse the repository at this point in the history
if stringBuffer only contains "$" we can't peek at the next character, so make sure that there are enough character to peek at.
  • Loading branch information
drantor authored Nov 17, 2024
1 parent 7a53198 commit e885408
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static Optional<Builder> parse(String rawQuery) {
builder.negate();
}

if (stringBuffer.peek() == '$' && stringBuffer.peek(1) == ':') {
if (stringBuffer.canRead(2) && stringBuffer.peek() == '$' && stringBuffer.peek(1) == ':') {
stringBuffer.skip();
stringBuffer.skip();
builder.regex();
Expand Down

0 comments on commit e885408

Please sign in to comment.