Skip to content

Commit 043289d

Browse files
committed
Fix to avoid possible NPE
1 parent 4a68f31 commit 043289d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/SearchHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ private void maybeRedirectToMatchOffset(int docID, List<String> contextFields)
468468
Query rewritten = query.rewrite(reader);
469469
Weight weight = rewritten.createWeight(searcher, ScoreMode.COMPLETE_NO_SCORES, 1);
470470
Matches matches = weight.matches(leaf, docID);
471-
if (matches != MatchesUtils.MATCH_WITH_NO_TERMS) {
471+
if (matches != null && matches != MatchesUtils.MATCH_WITH_NO_TERMS) {
472472
int matchCount = 0;
473473
int offset = -1;
474474
for (String field : contextFields) {

0 commit comments

Comments
 (0)