fixed segmentation fault

This commit is contained in:
Daniel Marjamäki 2010-01-08 21:54:24 +01:00
parent ca74f57fd0
commit 2dd0907146
2 changed files with 14 additions and 0 deletions

View File

@ -58,6 +58,9 @@ bool ExecutionPath::parseCondition(const Token &tok, std::list<ExecutionPath *>
static const Token *checkExecutionPaths_(const Token *tok, std::list<ExecutionPath *> &checks)
{
if (!tok || tok->str() == "}" || checks.empty())
return 0;
const std::auto_ptr<ExecutionPath> check(checks.front()->copy());
for (; tok; tok = tok->next())

View File

@ -1601,6 +1601,17 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo()\n"
"{\n"
" {\n"
" for (int i = 0; i < 10; ++i)\n"
" { }\n"
" }\n"
"\n"
" { }\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// macro_for..
checkUninitVar("int foo()\n"
"{\n"