Throw image loading error faster

This commit is contained in:
Andrew Murray 2020-04-17 18:29:45 +10:00
parent 49e49d3cfc
commit fe8225732a
2 changed files with 4 additions and 4 deletions

View File

@ -150,10 +150,10 @@ class ImageFile(Image.Image):
def load(self):
"""Load image data based on tile list"""
pixel = Image.Image.load(self)
if self.tile is None:
raise OSError("cannot load this image")
pixel = Image.Image.load(self)
if not self.tile:
return pixel

View File

@ -1094,10 +1094,10 @@ class TiffImageFile(ImageFile.ImageFile):
""" Overload method triggered when we detect a compressed tiff
Calls out to libtiff """
pixel = Image.Image.load(self)
if self.tile is None:
raise OSError("cannot load this image")
pixel = Image.Image.load(self)
if not self.tile:
return pixel