Skip to content

Commit

Permalink
Merge pull request #1530 from libris/feature/fix-search2-whitespace-i…
Browse files Browse the repository at this point in the history
…ndex-out-of-bounds

fix(rest/search2): index of out bounds if query is whitespace or ends with 2+ whitespace
  • Loading branch information
andersju authored Nov 29, 2024
2 parents 87534ea + a221ccc commit fef5958
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions whelk-core/src/main/groovy/whelk/search2/parse/Lex.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public static LinkedList<Symbol> lexQuery(String queryString) throws InvalidQuer
}

private static void consumeWhiteSpace(StringBuilder query, MutableInteger offset) {
if (query.isEmpty())
return;
while (Character.isWhitespace(query.charAt(0))) {
while (!query.isEmpty() && Character.isWhitespace(query.charAt(0))) {
query.deleteCharAt(0);
offset.increase(1);
}
Expand Down

0 comments on commit fef5958

Please sign in to comment.