Mercurial > geeqie.yaz
changeset 872:caf27dd8f8e0
fixed division by zero in pixbuf_renderer_get_scroll_center
author | nadvornik |
---|---|
date | Mon, 30 Jun 2008 21:08:28 +0000 |
parents | 3093f50c7181 |
children | bd3bdceb1230 |
files | src/pixbuf-renderer.c |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pixbuf-renderer.c Sun Jun 29 15:51:54 2008 +0000 +++ b/src/pixbuf-renderer.c Mon Jun 30 21:08:28 2008 +0000 @@ -3525,8 +3525,15 @@ src_x = pr->x_scroll + pr->vis_width / 2; src_y = pr->y_scroll + pr->vis_height / 2; - *x = (gdouble)src_x / pr->width; - *y = (gdouble)src_y / pr->height; + if (pr->width) + *x = (gdouble)src_x / pr->width; + else + *x = 0.5; /* center */ + + if (pr->height) + *y = (gdouble)src_y / pr->height; + else + *y = 0.5; /* center */ } void pixbuf_renderer_set_scroll_center(PixbufRenderer *pr, gdouble x, gdouble y)