Merge pull request #4563 from radarhere/faster_error

Throw image loading error faster
This commit is contained in:
Andrew Murray 2020-04-17 19:07:03 +10:00 committed by GitHub
commit e4fa234340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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