diff --git a/tds/src/main/java/thredds/server/radarServer2/RadarDataInventory.java b/tds/src/main/java/thredds/server/radarServer2/RadarDataInventory.java index 84c38e23ec..43620b72bd 100644 --- a/tds/src/main/java/thredds/server/radarServer2/RadarDataInventory.java +++ b/tds/src/main/java/thredds/server/radarServer2/RadarDataInventory.java @@ -523,7 +523,9 @@ private List getSubDirs(MFile directory) { final CollectionConfig dirs = new CollectionConfig("dirs", directory.getPath(), false, null, null); final Iterator dirIterator = mController.getSubdirs(dirs, true); - dirIterator.forEachRemaining(mFiles::add); + if (dirIterator != null) { + dirIterator.forEachRemaining(mFiles::add); + } return mFiles; } @@ -534,7 +536,9 @@ private List getFiles(MFile directory) throws IOException { final CollectionConfig files = new CollectionConfig("files", directory.getPath(), false, null, null); final Iterator fileIterator = mController.getInventoryTop(files, true); - fileIterator.forEachRemaining(mFiles::add); + if (fileIterator != null) { + fileIterator.forEachRemaining(mFiles::add); + } return mFiles; }