Skip to content

Commit

Permalink
fix npe during sort
Browse files Browse the repository at this point in the history
  • Loading branch information
probakowski committed Apr 8, 2020
1 parent f4fcdc8 commit 9f3732a
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public static String findV2Template(Metadata metadata, String indexName, @Nullab
}

final List<IndexTemplateV2> candidates = new ArrayList<>(matchedTemplates.keySet());
CollectionUtil.timSort(candidates, Comparator.comparingLong(IndexTemplateV2::priority).reversed());
CollectionUtil.timSort(candidates, Comparator.nullsFirst(Comparator.comparingLong(IndexTemplateV2::priority).reversed()));

assert candidates.size() > 0 : "we should have returned early with no candidates";
IndexTemplateV2 winner = candidates.get(0);
Expand Down

0 comments on commit 9f3732a

Please sign in to comment.