summary refs log tree commit diff stats
path: root/lib/system/sysstr.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/sysstr.nim')
-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: