From c0fc92b7e4e328259404c46d2bc604b38d6087b4 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 22 Jun 2024 23:30:26 +0200 Subject: env: fix nil deref in client --- src/html/env.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit 1.4.1-2-gfad0