Skip to content

Commit

Permalink
Add a check on SearchHits.getHits() length
Browse files Browse the repository at this point in the history
Signed-off-by: Megha Goyal <[email protected]>
  • Loading branch information
goyamegh committed Feb 8, 2024
1 parent 1e8a222 commit 2a1b7e0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void onResponse(SearchResponse response) {

SearchHits hits = response.getHits();
// Detectors Index hits count could be more even if we fetch one
if (hits.getTotalHits().value >= 1) {
if (hits.getTotalHits().value >= 1 && hits.getHits().length > 0) {
try {
SearchHit hit = hits.getAt(0);

Expand Down

0 comments on commit 2a1b7e0

Please sign in to comment.