From 75d1ca2624bb488c0e56a6a23abbca60794abcd2 Mon Sep 17 00:00:00 2001 From: qua-non Date: Sun, 9 Dec 2012 07:51:28 +0530 Subject: [PATCH] Core:Loader fix crash on invalid filehandle and img_pygame: fix indentation closes #265 --- kivy/core/image/img_pygame.py | 2 +- kivy/loader.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kivy/core/image/img_pygame.py b/kivy/core/image/img_pygame.py index 04cc70bfc..8166a8973 100644 --- a/kivy/core/image/img_pygame.py +++ b/kivy/core/image/img_pygame.py @@ -59,7 +59,7 @@ class ImageLoaderPygame(ImageLoaderBase): Logger.warning( 'Image: Unable to convert image %r to rgba (was %r)' % (filename, im.fmt)) - raise + raise im = imc # update internals diff --git a/kivy/loader.py b/kivy/loader.py index 9e40af221..a979b3b94 100644 --- a/kivy/loader.py +++ b/kivy/loader.py @@ -183,7 +183,10 @@ class LoaderBase(object): except Exception: Logger.exception('Failed to load image <%s>' % filename) # close file when remote file not found or download error - close(_out_osfd) + try: + close(_out_osfd) + except OSError: + pass return self.error_image finally: if _out_filename != '':