summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2010-03-31 19:14:01 +0000
committerVincent Sanders <vince@netsurf-browser.org>2010-03-31 19:14:01 +0000
commit0194e4bb55ca90f447344403ed01fea5a7a3fed6 (patch)
tree2af7c53e85e3a41c57d17d73ba3aaf05f2d3348b /framebuffer
parent7e551cf94f8ca395e8d5b0fba5e1ab963fc3f7d5 (diff)
downloadnetsurf-0194e4bb55ca90f447344403ed01fea5a7a3fed6.tar.gz
netsurf-0194e4bb55ca90f447344403ed01fea5a7a3fed6.tar.bz2
avoid diviosion by zero errors;
svn path=/trunk/netsurf/; revision=10223
Diffstat (limited to 'framebuffer')
-rw-r--r--framebuffer/gui.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 62ca77131..8d2759d84 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1174,15 +1174,20 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
void gui_window_update_extent(struct gui_window *gw)
{
int pct;
+ int width;
+ int height;
- pct = (fbtk_get_width(gw->browser) * 100) /
- content_get_width(gw->bw->current_content);
- fbtk_set_scroll(gw->hscroll, pct);
-
- pct = (fbtk_get_height(gw->browser) * 100) /
- content_get_height(gw->bw->current_content);
- fbtk_set_scroll(gw->vscroll, pct);
+ width = content_get_width(gw->bw->current_content);
+ if (width != 0) {
+ pct = (fbtk_get_width(gw->browser) * 100) / width;
+ fbtk_set_scroll(gw->hscroll, pct);
+ }
+ height = content_get_height(gw->bw->current_content);
+ if (height != 0) {
+ pct = (fbtk_get_height(gw->browser) * 100) / height;
+ fbtk_set_scroll(gw->vscroll, pct);
+ }
}
void gui_window_set_status(struct gui_window *g, const char *text)