summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-11-15 18:12:53 +0100
committerGitHub <noreply@github.com>2020-11-15 18:12:53 +0100
commitfc735e4b08d9401dc2b22a1432d1231fa18b4a4f (patch)
treebdac672212785a1f9253d23f1c4fcc385828d571 /lib/core
parent7eb34d170a489c2a0ed90d921f3f7cc6813f19c1 (diff)
parenta86aa310813d326d88959534c36b5499870dcb95 (diff)
downloadNim-fc735e4b08d9401dc2b22a1432d1231fa18b4a4f.tar.gz
fix #15934 and #15620 (#15938) [backport:1.4]
* make workaround for #15934 and #15620
* add testcase for #9754
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/typeinfo.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim
index 5c4e1b601..00f7c176c 100644
--- a/lib/core/typeinfo.nim
+++ b/lib/core/typeinfo.nim
@@ -327,7 +327,10 @@ proc setPointer*(x: Any, y: pointer) =
   ## ``akString``, ``akCString``, ``akProc``, ``akRef``, ``akPtr``,
   ## ``akPointer``, ``akSequence``.
   assert x.rawType.kind in pointerLike
-  genericAssign(x.value, y, x.rawType)
+  if y != nil:
+    genericAssign(x.value, y, x.rawType)
+  else:
+    cast[ppointer](x.value)[] = nil
 
 proc fieldsAux(p: pointer, n: ptr TNimNode,
                ret: var seq[tuple[name: cstring, any: Any]]) =