From ae32163f34de88ef624a0411633b141abb2e1d1b Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 8 Mar 2010 17:44:38 +0100 Subject: [PATCH] Fix #398. Tested by Deewiant. --- gen/statements.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gen/statements.cpp b/gen/statements.cpp index 41ef216f..7e5c5725 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -295,7 +295,8 @@ void WhileStatement::toIR(IRState* p) // while body code p->func()->gen->targetScopes.push_back(IRTargetScope(this,NULL,whilebb,endbb)); - body->toIR(p); + if (body) + body->toIR(p); p->func()->gen->targetScopes.pop_back(); // loop @@ -331,7 +332,8 @@ void DoStatement::toIR(IRState* p) // do-while body code p->func()->gen->targetScopes.push_back(IRTargetScope(this,NULL,condbb,endbb)); - body->toIR(p); + if (body) + body->toIR(p); p->func()->gen->targetScopes.pop_back(); // branch to condition block @@ -401,7 +403,8 @@ void ForStatement::toIR(IRState* p) gIR->scope() = IRScope(forbodybb,forincbb); // do for body code - body->toIR(p); + if (body) + body->toIR(p); // move into the for increment block if (!gIR->scopereturned())