From 4d57a29eed27c881111ecd4f4d3d57d85d0dac1f Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 21 Jan 2025 17:30:37 +0100 Subject: layout: fix division by 0 --- src/css/layout.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/css/layout.nim b/src/css/layout.nim index 471c7364..3cc65578 100644 --- a/src/css/layout.nim +++ b/src/css/layout.nim @@ -1628,9 +1628,9 @@ proc addImage(ictx: var InlineContext; state: var InlineState; else: if osize.h > 0: atom.size.w = osize.w div osize.h * atom.size.h - elif not hasHeight: + elif not hasHeight and osize.w != 0: atom.size.h = osize.h div osize.w * atom.size.w - elif not hasWidth: + elif not hasWidth and osize.h != 0: atom.size.w = osize.w div osize.h * atom.size.h let iastate = InlineAtomState( vertalign: state.box.computed{"vertical-align"}, -- cgit