summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortransfuturist <timothy.schmid@gmail.com>2015-05-16 17:50:01 -0700
committertransfuturist <timothy.schmid@gmail.com>2015-05-16 17:50:01 -0700
commit3d80fcb8c6ff1e03922f517681efad65d79563fb (patch)
treee7eddc6dad9e7f12bc53a548088c0c86a75ca15f
parent7500eed0cfb56a1fc4812d57ac301ee9b7f50026 (diff)
downloadNim-3d80fcb8c6ff1e03922f517681efad65d79563fb.tar.gz
Add value check for NimNode items
-rw-r--r--lib/core/macros.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 48e4566b3..41998250e 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -708,9 +708,10 @@ proc `$`*(node: NimNode): string {.compileTime.} =
 proc ident*(name: string): NimNode {.compileTime,inline.} = newIdentNode(name)
   ## Create a new ident node from a string
 
-iterator items*(n: NimNode): NimNode {.inline.}=
-  for i in 0 .. high(n):
-    yield n[i]
+iterator items*(n: NimNode): NimNode {.inline.} =
+  if n[0] != nil:
+    for i in 0 .. high(n):
+      yield n[i]
 
 {.deprecated: [children: items].}