Resizing image check
Check for a denominator of 0 before resizing an image.
This commit is contained in:
parent
a97e82ef1c
commit
92b5de08ef
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue