Do not attempt to read IFD1 if absent

This commit is contained in:
Andrew Murray 2022-12-29 21:52:09 +11:00
parent a7f8e862cb
commit 1e3f3ab596

View File

@ -3687,7 +3687,7 @@ class Exif(MutableMapping):
def get_ifd(self, tag): def get_ifd(self, tag):
if tag not in self._ifds: if tag not in self._ifds:
if tag == ExifTags.IFD.IFD1: if tag == ExifTags.IFD.IFD1:
if self._info is not None: if self._info is not None and self._info.next != 0:
self._ifds[tag] = self._get_ifd_dict(self._info.next) self._ifds[tag] = self._get_ifd_dict(self._info.next)
elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]: elif tag in [ExifTags.IFD.Exif, ExifTags.IFD.GPSInfo]:
offset = self._hidden_data.get(tag, self.get(tag)) offset = self._hidden_data.get(tag, self.get(tag))