aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-22 23:30:26 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-22 23:30:26 +0200
commitc0fc92b7e4e328259404c46d2bc604b38d6087b4 (patch)
tree1f31b8b75cf1199c3062616a2a64ff7156f2a481
parentf6db5536c834185f7078e9614db7cca9faf3d153 (diff)
downloadchawan-c0fc92b7e4e328259404c46d2bc604b38d6087b4.tar.gz
env: fix nil deref in client
-rw-r--r--src/html/env.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index e8fbf4af..0a90007f 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -138,7 +138,9 @@ proc devicePixelRatio(window: Window): float64 {.jsfget.} = 1
proc setLocation(window: Window; s: string): Err[JSError]
{.jsfset: "location".} =
- window.document.setLocation(s)
+ if window.document == nil:
+ return errTypeError("document is null")
+ return window.document.setLocation(s)
func getWindow(window: Window): Window {.jsuffget: "window".} =
return window