value flow: fixed redundant null pointer check

This commit is contained in:
Daniel Marjamäki 2014-01-12 12:38:41 +01:00
parent d8262963d9
commit 21d317b7d6
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
// extra logic for unsigned variables 'i>=1' => possible value can also be 0 // extra logic for unsigned variables 'i>=1' => possible value can also be 0
const ValueFlow::Value val(tok, num); const ValueFlow::Value val(tok, num);
ValueFlow::Value val2; ValueFlow::Value val2;
if (var && num==1U && Token::Match(tok,"<=|>=")) { if (num==1U && Token::Match(tok,"<=|>=")) {
bool isunsigned = var->typeEndToken()->isUnsigned(); bool isunsigned = var->typeEndToken()->isUnsigned();
for (const Token* type = var->typeStartToken(); type != var->typeEndToken(); type = type->next()) for (const Token* type = var->typeStartToken(); type != var->typeEndToken(); type = type->next())
isunsigned |= type->isUnsigned(); isunsigned |= type->isUnsigned();