fixed segmentation fault
This commit is contained in:
parent
ca74f57fd0
commit
2dd0907146
|
@ -58,6 +58,9 @@ bool ExecutionPath::parseCondition(const Token &tok, std::list<ExecutionPath *>
|
||||||
|
|
||||||
static const Token *checkExecutionPaths_(const Token *tok, std::list<ExecutionPath *> &checks)
|
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());
|
const std::auto_ptr<ExecutionPath> check(checks.front()->copy());
|
||||||
|
|
||||||
for (; tok; tok = tok->next())
|
for (; tok; tok = tok->next())
|
||||||
|
|
|
@ -1601,6 +1601,17 @@ private:
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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..
|
// macro_for..
|
||||||
checkUninitVar("int foo()\n"
|
checkUninitVar("int foo()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue