Fixed crash on garbage code introduced by recent commit.
This commit is contained in:
parent
20a066bb14
commit
c92230dfee
|
@ -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, "(|[|<"))
|
||||
|
|
|
@ -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"
|
||||
"}");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue