zero division or useless condition: dont crash when variable declaration is not parsed correctly

This commit is contained in:
Daniel Marjamäki 2013-09-28 16:51:38 +02:00
parent 5aaaff46ee
commit c05a80d314
1 changed files with 3 additions and 1 deletions

View File

@ -2171,7 +2171,9 @@ void CheckOther::checkZeroDivisionOrUselessCondition()
if (!var)
continue;
bool isVarUnsigned = var->typeEndToken()->isUnsigned();
for (const Token *typetok = var->typeStartToken(); typetok != var->typeEndToken(); typetok = typetok->next()) {
for (const Token *typetok = var->typeStartToken(); typetok; typetok = typetok->next()) {
if (!typetok->isName() || typetok == var->typeEndToken())
break;
if (typetok->isUnsigned()) {
isVarUnsigned = true;
break;