diff --git a/components/formats-gpl/src/loci/formats/in/GelReader.java b/components/formats-gpl/src/loci/formats/in/GelReader.java index 37ed73714f7..1d0a2b36d41 100644 --- a/components/formats-gpl/src/loci/formats/in/GelReader.java +++ b/components/formats-gpl/src/loci/formats/in/GelReader.java @@ -90,7 +90,11 @@ public GelReader() { public boolean isThisType(RandomAccessInputStream stream) throws IOException { TiffParser parser = new TiffParser(stream); parser.setDoCaching(false); - IFD ifd = parser.getFirstIFD(); + long[] offsets = parser.getIFDOffsets(); + if (offsets.length == 0 || offsets.length > 2) { + return false; + } + IFD ifd = parser.getIFD(offsets[0]); if (ifd == null) return false; return ifd.containsKey(MD_FILETAG); }