summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-07-29 02:03:07 +0200
committerGitHub <noreply@github.com>2016-07-29 02:03:07 +0200
commit99f5ed8c530a10f0ca55c939e3d997fcf1a66a00 (patch)
tree1fa6efca132d2549142e249447bb0ea6d383631c /lib
parent953a5eb64438fb695424e71fde0f914ecf856372 (diff)
parentcc4bb892671c039c2a5c91c21a27f1a055eb4b10 (diff)
downloadNim-99f5ed8c530a10f0ca55c939e3d997fcf1a66a00.tar.gz
Merge pull request #4531 from oderwat/ctring-to.nimstring-nil-fix
Fix for cstring nil to string nil conversion with `$`
Diffstat (limited to 'lib')
-rw-r--r--lib/system/sysstr.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim
index 569470aa2..eb3d276e0 100644
--- a/lib/system/sysstr.nim
+++ b/lib/system/sysstr.nim
@@ -85,7 +85,8 @@ proc toNimStr(str: cstring, len: int): NimString {.compilerProc.} =
   copyMem(addr(result.data), str, len + 1)
 
 proc cstrToNimstr(str: cstring): NimString {.compilerRtl.} =
-  result = toNimStr(str, str.len)
+  if str == nil: NimString(nil)
+  else: toNimStr(str, str.len)
 
 proc copyString(src: NimString): NimString {.compilerRtl.} =
   if src != nil: