Skip to content

Commit 215523d

Browse files
committed
fix NPE occuring in ci
1 parent 5b5ede4 commit 215523d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/retriever/PinnedRetrieverBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ private QueryBuilder createPinnedQuery(QueryBuilder baseQuery) {
175175
@Override
176176
protected SearchSourceBuilder finalizeSourceBuilder(SearchSourceBuilder source) {
177177
validateSort(source);
178-
source.query(createPinnedQuery(source.query()));
178+
QueryBuilder underlyingQuery = source.query();
179+
if (underlyingQuery == null) {
180+
throw new IllegalArgumentException("[underlying query] must not be null for pinned retriever");
181+
}
182+
source.query(createPinnedQuery(underlyingQuery));
179183
return source;
180184
}
181185

0 commit comments

Comments
 (0)