diff --git a/src/PIL/ImageFile.py b/src/PIL/ImageFile.py index f905b34b666..3476e48ffae 100644 --- a/src/PIL/ImageFile.py +++ b/src/PIL/ImageFile.py @@ -180,6 +180,7 @@ def get_child_images(self) -> list[ImageFile]: ifds.append((ifd1, exif._info.next)) offset = None + assert self.fp is not None for ifd, ifd_offset in ifds: current_offset = self.fp.tell() if offset is None: