about summary refs log tree commit diff stats
path: root/src/server/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-11-29 12:37:25 +0100
committerbptato <nincsnevem662@gmail.com>2023-11-29 12:37:25 +0100
commite60058104562571b20a5c6408b06dfa7d9df866b (patch)
tree6dff4a864f400af5fe05e9b576f656f93b917967 /src/server/buffer.nim
parent4a216fe8b463cd48798feb996b2a42daff7302a9 (diff)
downloadchawan-e60058104562571b20a5c6408b06dfa7d9df866b.tar.gz
buffer: do not set readyState if document is nil
As the comment says, buffer.document only exists if buffer.ishtml
is true.
Diffstat (limited to 'src/server/buffer.nim')
-rw-r--r--src/server/buffer.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/server/buffer.nim b/src/server/buffer.nim
index 82774fe7..127e0967 100644
--- a/src/server/buffer.nim
+++ b/src/server/buffer.nim
@@ -1137,7 +1137,8 @@ proc onload(buffer: Buffer) =
       res.atend = true
       buffer.finishLoad().then(proc() =
         buffer.state = LOADED
-        buffer.document.readyState = READY_STATE_COMPLETE
+        if buffer.document != nil: # may be nil if not buffer.ishtml
+          buffer.document.readyState = READY_STATE_COMPLETE
         buffer.dispatchLoadEvent()
         buffer.resolveTask(LOAD, res))
       return