about summary refs log tree commit diff stats
path: root/src/render
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-01-03 03:28:49 +0100
committerbptato <nincsnevem662@gmail.com>2023-01-03 03:31:59 +0100
commit222487b3a20dd18a3f024249a2cb90d00ce535bd (patch)
treea7a120afe25190dd9377194e4827ced21ef495e3 /src/render
parent1a9acf7046565ac281834a5cf2c1d590da159e86 (diff)
downloadchawan-222487b3a20dd18a3f024249a2cb90d00ce535bd.tar.gz
renderdocument: fix crash for image text
We need to check if y >= 0, or it fails.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/renderdocument.nim3
1 files changed, 2 insertions, 1 deletions
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)