From a4d27d0b0f987e0b8aa124558623d1e3ba908e60 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 24 Apr 2011 09:18:44 -0400 Subject: [PATCH] ocarina: Catch exception on empty album art file I don't want to set the image to an empty file. Improving the cache so that it doesn't store empty files is the best solution, so for now I just check the error (and keep the function from uninviting itself from the POSTGETART event) --- ocarina/body/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ocarina/body/image.py b/ocarina/body/image.py index d0a9be52..c002b6f2 100644 --- a/ocarina/body/image.py +++ b/ocarina/body/image.py @@ -14,7 +14,10 @@ def find_new_width(buf, new_h): return (float(w) / float(h)) * new_h def resize(img, new_h): - buf = img.get_pixbuf() + try: + buf = img.get_pixbuf() + except Exception, e: + return if buf == None: return new_w = find_new_width(buf, new_h)