From e60058104562571b20a5c6408b06dfa7d9df866b Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 29 Nov 2023 12:37:25 +0100 Subject: buffer: do not set readyState if document is nil As the comment says, buffer.document only exists if buffer.ishtml is true. --- src/server/buffer.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/server/buffer.nim') 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 -- cgit 1.4.1-2-gfad0