From 9dcf2c25ac3f25f147fbaa82f96f89afe95d7c81 Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Thu, 3 Oct 2024 12:51:00 -0600 Subject: [PATCH] Fix nullptr exception --- .../thredds/server/radarServer2/RadarDataInventory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }