summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-02-14 12:56:52 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-02-14 12:56:52 +0000
commit3d69933e45f711da98f64e4c1753c6a04cd14fa4 (patch)
tree9d173ec7ddc98fcfada3083fc9f011e95f975c2e /render
parent9336ea3ac8566712edbc70692ec127e021a7bb73 (diff)
downloadnetsurf-3d69933e45f711da98f64e4c1753c6a04cd14fa4.tar.gz
netsurf-3d69933e45f711da98f64e4c1753c6a04cd14fa4.tar.bz2
Avoid potential divide by 0.
svn path=/trunk/netsurf/; revision=11675
Diffstat (limited to 'render')
-rw-r--r--render/layout.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/render/layout.c b/render/layout.c
index 213082ee6..561a95af5 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -1197,14 +1197,21 @@ void layout_float_find_dimensions(int available_width,
if (width == AUTO && height == AUTO) {
width = content_get_width(box->object);
height = content_get_height(box->object);
- } else if (width == AUTO)
- width = content_get_width(box->object) *
- (float) height /
- content_get_height(box->object);
- else if (height == AUTO)
- height = content_get_height(box->object) *
- (float) width /
- content_get_width(box->object);
+ } else if (width == AUTO) {
+ if (content_get_height(box->object))
+ width = content_get_width(box->object) *
+ (float) height /
+ content_get_height(box->object);
+ else
+ width = content_get_width(box->object);
+ } else if (height == AUTO) {
+ if (content_get_width(box->object))
+ height = content_get_height(box->object) *
+ (float) width /
+ content_get_width(box->object);
+ else
+ height = content_get_height(box->object);
+ }
} else if (box->gadget && (box->gadget->type == GADGET_TEXTBOX ||
box->gadget->type == GADGET_PASSWORD ||
box->gadget->type == GADGET_FILE ||