Skip to content

Commit eeaf2e5

Browse files
committed
klocwork fixes; check that astSibling for comparison op does not return nullptr. remove check that pointer is non-null, the check should be redundant.
1 parent ce029f3 commit eeaf2e5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/checkstl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ static bool if_findCompare(const Token * const tokBack, bool stdStringLike)
13521352
if (tok->isComparisonOp()) {
13531353
if (stdStringLike) {
13541354
const Token * const tokOther = tokBack->astSibling();
1355-
return !tokOther->hasKnownIntValue() || tokOther->getKnownIntValue() != 0;
1355+
return !tokOther || !tokOther->hasKnownIntValue() || tokOther->getKnownIntValue() != 0;
13561356
}
13571357
return (!tok->astOperand1()->isNumber() && !tok->astOperand2()->isNumber());
13581358
}
@@ -1379,7 +1379,7 @@ void CheckStl::if_find()
13791379
continue;
13801380

13811381
const Token *conditionStart = scope.classDef->next();
1382-
if (conditionStart && Token::simpleMatch(conditionStart->astOperand2(), ";"))
1382+
if (Token::simpleMatch(conditionStart->astOperand2(), ";"))
13831383
conditionStart = conditionStart->astOperand2();
13841384

13851385
for (const Token *tok = conditionStart; tok->str() != "{"; tok = tok->next()) {

0 commit comments

Comments
 (0)