diff --git a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java index 042638806..22cce134e 100644 --- a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java +++ b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java @@ -549,9 +549,11 @@ private void mergeRecords(CSWServiceItem cswService, CSWRecord destination, CSWR } } } - CSWGeographicElement geoElemArr[] = new CSWGeographicElement[geoElemSet.size()]; - geoElemSet.toArray(geoElemArr); - destination.setCSWGeographicElements(geoElemArr); + if (geoElemSet.size() > 0) { + CSWGeographicElement geoElemArr[] = new CSWGeographicElement[geoElemSet.size()]; + geoElemSet.toArray(geoElemArr); + destination.setCSWGeographicElements(geoElemArr); + } // Merge constraints, accessConstraints and useLimitConstraints (no dupes) Set constraintSet = new HashSet<>();