aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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