summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorHans Raaf <hara@oderwat.de>2016-07-29 01:39:33 +0200
committerHans Raaf <hara@oderwat.de>2016-07-29 01:39:33 +0200
commitcc4bb892671c039c2a5c91c21a27f1a055eb4b10 (patch)
treec99ef9e3306108e8aec445a8c593573307cb0ffc /lib
parentf18ff6a033643dc861002b18124feafb52cedfd3 (diff)
downloadNim-cc4bb892671c039c2a5c91c21a27f1a055eb4b10.tar.gz
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: