Fixed crash when checking tinyxml introduced by previous commit

This commit is contained in:
PKEuS 2014-05-18 13:35:00 +02:00
parent 20753f4697
commit 780719665f
1 changed files with 5 additions and 5 deletions

View File

@ -423,16 +423,16 @@ void CheckOther::clarifyStatement()
for (std::size_t i = 0; i < functions; ++i) { for (std::size_t i = 0; i < functions; ++i) {
const Scope * scope = symbolDatabase->functionScopes[i]; const Scope * scope = symbolDatabase->functionScopes[i];
for (const Token* tok = scope->classStart; tok && tok != scope->classEnd; tok = tok->next()) { for (const Token* tok = scope->classStart; tok && tok != scope->classEnd; tok = tok->next()) {
if (Token::Match(tok, "* %var%")) { if (Token::Match(tok, "* %var%") && tok->astOperand1()) {
const Token *tok2=tok->previous(); const Token *tok2=tok->previous();
while (tok2 && tok2->str() == "*") while (tok2 && tok2->str() == "*")
tok2=tok2->previous(); tok2 = tok2->previous();
if (Token::Match(tok2, "[{};]")) { if (Token::Match(tok2, "[{};]")) {
tok = tok->astOperand1(); tok2 = tok->astOperand1();
if (Token::Match(tok, "++|-- [;,]")) if (Token::Match(tok2, "++|-- [;,]"))
clarifyStatementError(tok); clarifyStatementError(tok2);
} }
} }
} }