From 222487b3a20dd18a3f024249a2cb90d00ce535bd Mon Sep 17 00:00:00 2001 From: bptato Date: Tue, 3 Jan 2023 03:28:49 +0100 Subject: renderdocument: fix crash for image text We need to check if y >= 0, or it fails. --- src/render/renderdocument.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/render') diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 46d8a003..fd4be8da 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -311,7 +311,8 @@ proc renderBlockContext(grid: var FlexibleGrid, ctx: BlockBox, x, y: int, window x += ctx.width div 2 x = x div window.ppc y = y div window.ppl - grid.setText(s, ComputedFormat(node: ctx.node), x, y) + if y >= 0 and x + w >= 0: + grid.setText(s, ComputedFormat(node: ctx.node), x, y) if ctx of ListItemBox: let ctx = ListItemBox(ctx) -- cgit 1.4.1-2-gfad0