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),