summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 2c5790d5e..cb211e6a9 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -3412,9 +3412,10 @@ elif hasAlloc:
   {.push stack_trace:off, profiler:off.}
   proc add*(x: var string, y: cstring) =
     var i = 0
-    while y[i] != '\0':
-      add(x, y[i])
-      inc(i)
+    if y != nil:
+      while y[i] != '\0':
+        add(x, y[i])
+        inc(i)
   {.pop.}
 
 when defined(nimvarargstyped):