about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/html/catom.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/html/catom.nim b/src/html/catom.nim
index 62451941..5f4889e8 100644
--- a/src/html/catom.nim
+++ b/src/html/catom.nim
@@ -338,9 +338,12 @@ proc fromJS*(ctx: JSContext; val: JSValue; res: var CAtom): Opt[void] =
   return ok()
 
 proc fromJS*(ctx: JSContext; val: JSAtom; res: var CAtom): Opt[void] =
-  var s: string
-  ?ctx.fromJS(val, s)
-  res = ctx.getFactoryImpl().toAtom(s)
+  if val == JS_ATOM_NULL:
+    res = CAtomNull
+  else:
+    var s: string
+    ?ctx.fromJS(val, s)
+    res = ctx.getFactoryImpl().toAtom(s)
   return ok()
 
 proc fromJS*(ctx: JSContext; val: JSAtom; res: var StaticAtom): Opt[void] =