zero division or useless condition: dont crash when variable declaration is not parsed correctly
This commit is contained in:
parent
5aaaff46ee
commit
c05a80d314
|
@ -2171,7 +2171,9 @@ void CheckOther::checkZeroDivisionOrUselessCondition()
|
||||||
if (!var)
|
if (!var)
|
||||||
continue;
|
continue;
|
||||||
bool isVarUnsigned = var->typeEndToken()->isUnsigned();
|
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()) {
|
if (typetok->isUnsigned()) {
|
||||||
isVarUnsigned = true;
|
isVarUnsigned = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue