From 30dc860b6ccb600aa185bde8bf99a5587a4d660b Mon Sep 17 00:00:00 2001 From: David Gault Date: Fri, 14 Jun 2024 14:06:07 +0100 Subject: [PATCH] ICS: Fix NPE when image name is empty --- .../formats-bsd/src/loci/formats/in/ICSReader.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/formats-bsd/src/loci/formats/in/ICSReader.java b/components/formats-bsd/src/loci/formats/in/ICSReader.java index 0513eac024e..c6260c20f29 100644 --- a/components/formats-bsd/src/loci/formats/in/ICSReader.java +++ b/components/formats-bsd/src/loci/formats/in/ICSReader.java @@ -1478,10 +1478,12 @@ else if (labels.equalsIgnoreCase("x y t")) { MetadataTools.populatePixels(store, this, true); // populate Image data - imageName = imageName.replace('/', File.separatorChar); - imageName = imageName.replace('\\', File.separatorChar); - imageName = imageName.substring(imageName.lastIndexOf(File.separator) + 1); - store.setImageName(imageName, 0); + if (imageName != null) { + imageName = imageName.replace('/', File.separatorChar); + imageName = imageName.replace('\\', File.separatorChar); + imageName = imageName.substring(imageName.lastIndexOf(File.separator) + 1); + store.setImageName(imageName, 0); + } if (date != null) store.setImageAcquisitionDate(new Timestamp(date), 0);