diff options
Diffstat (limited to 'render/layout.c')
-rw-r--r-- | render/layout.c | 23 |
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 || |