summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-07-09 15:05:46 -0700
committerAraq <rumpf_a@web.de>2013-07-09 15:05:46 -0700
commit1af2d94860eb56446c1cc0eaddebb2a79a8e3ff8 (patch)
tree79a3e8d505b291358f2a3cb13cbb2daba9bf7b47
parentdbb87bc557ef633ad544502d90137a6f55e67dc4 (diff)
parent172945de31d152e362636daca3fb968481d96bdb (diff)
downloadNim-1af2d94860eb56446c1cc0eaddebb2a79a8e3ff8.tar.gz
Merge pull request #519 from gradha/pr_guards_against_nil_ast
Avoids usefulFact recursion with nil parameter. Fixes #518.
-rw-r--r--compiler/guards.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/guards.nim b/compiler/guards.nim
index f02a53684..c43e918d9 100644
--- a/compiler/guards.nim
+++ b/compiler/guards.nim
@@ -187,7 +187,8 @@ proc usefulFact(n: PNode): PNode =
     #   if a:
     #     ...
     # We make can easily replace 'a' by '2 < x' here:
-    result = usefulFact(n.sym.ast)
+    if n.sym.ast != nil:
+      result = usefulFact(n.sym.ast)
   elif n.kind == nkStmtListExpr:
     result = usefulFact(n.lastSon)