From a5d90ad9f84d1c3d9cc989fca66fe8abd9c81d8e Mon Sep 17 00:00:00 2001 From: David Gault Date: Tue, 9 Jul 2024 11:14:55 +0100 Subject: [PATCH] ImarisHDF: Handle null color rather than removing it --- .../formats-gpl/src/loci/formats/in/ImarisHDFReader.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/formats-gpl/src/loci/formats/in/ImarisHDFReader.java b/components/formats-gpl/src/loci/formats/in/ImarisHDFReader.java index 39a0b3e6189..172ec0cb69b 100644 --- a/components/formats-gpl/src/loci/formats/in/ImarisHDFReader.java +++ b/components/formats-gpl/src/loci/formats/in/ImarisHDFReader.java @@ -130,7 +130,7 @@ public short[][] get16BitLookupTable() { FormatTools.assertId(currentId, true, 1); if (getPixelType() != FormatTools.UINT16 || !isIndexed()) return null; - if (lastChannel < 0 || lastChannel >= colors.size()) { + if (lastChannel < 0 || lastChannel >= colors.size() || colors.get(lastChannel) == null) { return null; } @@ -408,8 +408,7 @@ protected void initFile(String id) throws FormatException, IOException { catch (NumberFormatException e) { } } - colors.remove(null); - if (i < colors.size()) { + if (i < colors.size() && colors.get(i) != null) { double[] color = colors.get(i); Color realColor = new Color( (int) (color[0] * 255), (int) (color[1] * 255),