Skip to content

Commit 2d0f4c6

Browse files
Fix null deref
1 parent 6ac9d8c commit 2d0f4c6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ private static void checkProjectRouting(SearchRequest searchRequest, boolean res
430430
* Because we do not have access to `IndicesRequest/SearchRequest` from `SearchSourceBuilder`, and, project_routing
431431
* can be potentially specified in 2 different places, we need to explicitly check this scenario.
432432
*/
433+
if (searchRequest.source() == null) {
434+
return;
435+
}
436+
433437
String projectRoutingInBody = searchRequest.source().projectRouting();
434438
// If it's null, either the query parameter is also null or it isn't. Either way, we're fine with it.
435439
if (projectRoutingInBody != null) {

0 commit comments

Comments
 (0)