From bb4eb53859d48c7e57687bc1ffe8eb4bd39d90e4 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Tue, 26 Feb 2013 16:31:44 +0600 Subject: [PATCH] fix UnboundLocalError errors --- PIL/ImageFile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PIL/ImageFile.py b/PIL/ImageFile.py index 3b60c0d05..17fda52e5 100644 --- a/PIL/ImageFile.py +++ b/PIL/ImageFile.py @@ -205,10 +205,10 @@ class ImageFile(Image.Image): break else: raise IndexError(ie) - + if not s: # truncated jpeg self.tile = [] - + if LOAD_TRUNCATED_IMAGES: break else: @@ -226,7 +226,7 @@ class ImageFile(Image.Image): self.fp = None # might be shared - if (t == 0 or not LOAD_TRUNCATED_IMAGES) and not self.map and e < 0: + if (not LOAD_TRUNCATED_IMAGES or t == 0) and not self.map and e < 0: # still raised if decoder fails to return anything raise_ioerror(e)