summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-08-02 02:16:45 +0200
committerAraq <rumpf_a@web.de>2015-08-02 02:56:02 +0200
commitf9750781c04cf0f2f278ef4ce8734ba9bc3e859c (patch)
tree97159a5cc7166baf86d250e54d12e24cae4e124b
parentea35cede8e99b936c4a3003640844335001fe0b3 (diff)
downloadNim-f9750781c04cf0f2f278ef4ce8734ba9bc3e859c.tar.gz
fixes #3080
-rw-r--r--lib/system/repr.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/system/repr.nim b/lib/system/repr.nim
index 74396f424..b4188527f 100644
--- a/lib/system/repr.nim
+++ b/lib/system/repr.nim
@@ -256,7 +256,10 @@ when not defined(useNimRtl):
     of tyBool: add result, reprBool(cast[ptr bool](p)[])
     of tyChar: add result, reprChar(cast[ptr char](p)[])
     of tyString: reprStrAux(result, cast[ptr string](p)[])
-    of tyCString: reprStrAux(result, $(cast[ptr cstring](p)[]))
+    of tyCString:
+      let cs = cast[ptr cstring](p)[]
+      if cs.isNil: add result, "nil"
+      else: reprStrAux(result, $cs)
     of tyRange: reprAux(result, p, typ.base, cl)
     of tyProc, tyPointer:
       if cast[PPointer](p)[] == nil: add result, "nil"