summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index ce4ee7536..ece94a567 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2102,12 +2102,14 @@ when not defined(js):
     proc cstringArrayToSeq*(a: cstringArray, len: Natural): seq[string] =
       ## Converts a `cstringArray` to a `seq[string]`. `a` is supposed to be
       ## of length `len`.
+      if a == nil: return @[]
       newSeq(result, len)
       for i in 0..len-1: result[i] = $a[i]
 
     proc cstringArrayToSeq*(a: cstringArray): seq[string] =
       ## Converts a `cstringArray` to a `seq[string]`. `a` is supposed to be
       ## terminated by `nil`.
+      if a == nil: return @[]
       var L = 0
       while a[L] != nil: inc(L)
       result = cstringArrayToSeq(a, L)