about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-25 21:12:05 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-25 21:12:05 +0200
commit670e5dd9ae31a6d1bd34df2c7f2af5eabd213b54 (patch)
tree6d612b8a23ad030b4629afa2ce9985a0e1467732
parent2ade1784f8b0476b32929e092250e01826342497 (diff)
downloadchawan-670e5dd9ae31a6d1bd34df2c7f2af5eabd213b54.tar.gz
rendertext: do not rewind if no other charsets are available
Fixes crash when the decoder fails to decode all given charsets.
-rw-r--r--src/render/rendertext.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/render/rendertext.nim b/src/render/rendertext.nim
index ed79d60f..b0538cd8 100644
--- a/src/render/rendertext.nim
+++ b/src/render/rendertext.nim
@@ -54,7 +54,7 @@ proc renderStream*(grid: var FlexibleGrid, renderer: var StreamRenderer, len: in
   var n: int
   while true:
     n = renderer.decoder.readData(addr buf[0], buf.len * sizeof(buf[0]))
-    if renderer.decoder.failed:
+    if renderer.decoder.failed and renderer.charsets.len > 0:
       renderer.rewind()
       continue
     break