From 172945de31d152e362636daca3fb968481d96bdb Mon Sep 17 00:00:00 2001 From: Grzegorz Adam Hankiewicz Date: Tue, 9 Jul 2013 23:31:13 +0200 Subject: [PATCH] Avoids usefulFact recursion with nil parameter. Fixes #518. --- compiler/guards.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/guards.nim b/compiler/guards.nim index f02a53684d..c43e918d9c 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)