Skip to content

Commit

Permalink
Add null handling for pagination param in setting annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
junghoon-vans committed Jan 8, 2025
1 parent 759669d commit 89bbda9
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static class SettingsParameter {
private String[] displayedAttributes;
private String[] rankingRules;
@Nullable private String[] stopWords;
private Pagination pagination;
@Nullable private Pagination pagination;

Settings toSettings() {
Settings settings = new Settings();
Expand All @@ -160,9 +160,11 @@ Settings toSettings() {
settings.setStopWords(stopWords);
}

var meiliPagination = new com.meilisearch.sdk.model.Pagination();
meiliPagination.setMaxTotalHits(this.pagination.maxTotalHits());
settings.setPagination(meiliPagination);
if (pagination != null) {
var meiliPagination = new com.meilisearch.sdk.model.Pagination();
meiliPagination.setMaxTotalHits(this.pagination.maxTotalHits());
settings.setPagination(meiliPagination);
}

return settings;
}
Expand Down

0 comments on commit 89bbda9

Please sign in to comment.