From 9e3c38b986e6e56e0f0c16beeea759e44972c74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Besson?= Date: Mon, 9 Sep 2024 08:51:59 +0100 Subject: [PATCH] CV7000: handle NullPointerException when resetting allFiles in close() While the reader should initialize this field as an empty ArrayList, there are scenarios where allFiles will be null when calling close(). A use case would be a reader initialized from a memo file created with a previous release of Bio-Formats since this field was formerly a string array set to null by default. --- .../formats-gpl/src/loci/formats/in/CV7000Reader.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/formats-gpl/src/loci/formats/in/CV7000Reader.java b/components/formats-gpl/src/loci/formats/in/CV7000Reader.java index 7ba74411d73..66b745a1c9e 100644 --- a/components/formats-gpl/src/loci/formats/in/CV7000Reader.java +++ b/components/formats-gpl/src/loci/formats/in/CV7000Reader.java @@ -223,7 +223,11 @@ public void close(boolean fileOnly) throws IOException { reversePlaneLookup = null; extraFiles = null; acquiredWells.clear(); - allFiles.clear(); + if (allFiles != null) { + allFiles.clear(); + } else { + allFiles = new ArrayList(); + } } }