diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/StacToCollections.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/StacToCollections.java index c7052c67..cd3c5887 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/StacToCollections.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/StacToCollections.java @@ -2,9 +2,7 @@ import au.org.aodn.ogcapi.features.model.Collection; import au.org.aodn.ogcapi.features.model.Collections; -import au.org.aodn.ogcapi.features.model.Link; import au.org.aodn.ogcapi.server.core.model.ExtendedCollections; -import au.org.aodn.ogcapi.server.core.model.StacCollectionModel; import au.org.aodn.ogcapi.server.core.service.ElasticSearch; import org.mapstruct.Mapper; import org.springframework.beans.factory.annotation.Value; @@ -28,7 +26,9 @@ public Collections convert(ElasticSearch.SearchResult model) { ExtendedCollections result = new ExtendedCollections(); result.setTotal(model.getTotal()); - result.setSearchAfter(model.getSortValues().stream().map(String::valueOf).toList()); + if(model.getSortValues() != null) { + result.setSearchAfter(model.getSortValues().stream().map(String::valueOf).toList()); + } result.setCollections(collections); return result;