Resizing image check

Check for a denominator of 0 before resizing an image.
This commit is contained in:
Bryan Schumaker 2010-11-02 19:35:38 -04:00
parent a97e82ef1c
commit 92b5de08ef
1 changed files with 3 additions and 1 deletions

View File

@ -20,8 +20,10 @@ class Image(gtk.Image):
h = buf.get_height()
if h == new_h:
return
if h == 0:
h = 1
new_w = (float(w) / float(h)) * new_h
if new_w>0 and new_h>0:
if new_w > 0 and new_h > 0:
buf = buf.scale_simple(int(new_w), int(new_h), gtk.gdk.INTERP_HYPER)
self.set_from_pixbuf(buf)