Fixed crash on garbage code introduced by recent commit.

This commit is contained in:
PKEuS 2014-09-01 12:41:30 +02:00
parent 20a066bb14
commit c92230dfee
2 changed files with 8 additions and 1 deletions

View File

@ -1115,7 +1115,7 @@ void CheckOther::checkUnreachableCode()
for (std::size_t i = 0; i < functions; ++i) {
const Scope * scope = symbolDatabase->functionScopes[i];
for (const Token* tok = scope->classStart; tok != scope->classEnd; tok = tok->next()) {
for (const Token* tok = scope->classStart; tok && tok != scope->classEnd; tok = tok->next()) {
const Token* secondBreak = 0;
const Token* labelName = 0;
if (tok->link() && Token::Match(tok, "(|[|<"))

View File

@ -2991,6 +2991,13 @@ private:
" per_state_info() : enter(0), exit(0), events(0) {}\n"
"};", 0, false, false, false, false);
ASSERT_EQUALS("", errout.str());
// Garbage code - don't crash
check("namespace pr16989 {\n"
" class C {\n"
" C tpl_mem(T *) { return }\n"
" };\n"
"}");
}