about summary refs log tree commit diff stats
path: root/src/css
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-14 11:58:01 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-14 11:58:01 +0100
commit811484c125162fa30aec11288e1ef3101382de88 (patch)
treec2f07f7792eb817a0682f389c5b696eb6a3cadb7 /src/css
parentcd6a4c275030e9f66eb6807fc965d667a67ce55f (diff)
downloadchawan-811484c125162fa30aec11288e1ef3101382de88.tar.gz
cssparser: check for EOF in first read chunk
To-do: use decoderstream...
Diffstat (limited to 'src/css')
-rw-r--r--src/css/cssparser.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/css/cssparser.nim b/src/css/cssparser.nim
index b4a22e28..29f88151 100644
--- a/src/css/cssparser.nim
+++ b/src/css/cssparser.nim
@@ -482,7 +482,10 @@ proc consumeToken(state: var CSSTokenizerState): CSSToken =
 proc tokenizeCSS*(inputStream: Stream): seq[CSSParsedItem] =
   var state: CSSTokenizerState
   state.stream = inputStream
-  state.buf = state.stream.readLine() & '\n'
+  try:
+    state.buf = state.stream.readStr(256)
+  except EOFError:
+    discard
   while state.has():
     let tok = state.consumeToken()
     if tok != nil: