From 744505c7d64e062fa1a517de7cf40b1d4163ac33 Mon Sep 17 00:00:00 2001 From: Talley Lambert Date: Thu, 12 Feb 2026 20:50:35 -0500 Subject: [PATCH] Fix null pointer exception on reopen by ensuring input stream is closed properly --- components/formats-api/src/loci/formats/FormatReader.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/formats-api/src/loci/formats/FormatReader.java b/components/formats-api/src/loci/formats/FormatReader.java index fee716b57f4..4fefe0a187c 100644 --- a/components/formats-api/src/loci/formats/FormatReader.java +++ b/components/formats-api/src/loci/formats/FormatReader.java @@ -946,9 +946,11 @@ public byte[] openThumbBytes(int no) throws FormatException, IOException { /* @see IFormatReader#close(boolean) */ @Override public void close(boolean fileOnly) throws IOException { - if (in != null) in.close(); - if (!fileOnly) { + if (in != null) { + in.close(); in = null; + } + if (!fileOnly) { currentId = null; resolution = 0; core = null;