Fixed #2241 (Segfault checking a file)
This commit is contained in:
parent
c9c6de24a6
commit
ea405d95c6
|
@ -1984,12 +1984,16 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
while (tok->str() != "{")
|
while (tok->str() != "{")
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
if (!tok)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip executing scopes (ticket #1984)..
|
// skip executing scopes (ticket #1984)..
|
||||||
if (Token::simpleMatch(tok, "; {"))
|
if (Token::simpleMatch(tok, "; {"))
|
||||||
{
|
{
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
|
if (!tok)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip executing scopes (ticket #1985)..
|
// skip executing scopes (ticket #1985)..
|
||||||
|
@ -2002,6 +2006,8 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
if (Token::simpleMatch(tok, ") {"))
|
if (Token::simpleMatch(tok, ") {"))
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
}
|
}
|
||||||
|
if (!tok)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not start of statement?
|
// not start of statement?
|
||||||
|
@ -8650,7 +8656,11 @@ void Tokenizer::simplifyBorland()
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
if (tok->str() == "{")
|
if (tok->str() == "{")
|
||||||
|
{
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
if (!tok)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (Token::Match(tok, "class %var% :|{"))
|
if (Token::Match(tok, "class %var% :|{"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue