summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/system.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index c5b0e0cc7..91495f31a 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2173,7 +2173,11 @@ proc `$`*[T: tuple|object](x: T): string =
     if not firstElement: result.add(", ")
     result.add(name)
     result.add(": ")
-    result.add($value)
+    when compiles(value.isNil):
+      if value.isNil: result.add "nil"
+      else: result.add($value)
+    else:
+      result.add($value)
     firstElement = false
   result.add(")")