Skip to content

Commit cbcca15

Browse files
committed
checkcondition.cpp: added missing hasKnownIntValue() check
1 parent de3203b commit cbcca15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/checkcondition.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ void CheckCondition::checkInvalidTestForOverflow()
16991699
const Token * const other = expr->astSibling();
17001700

17011701
// x [+-] c cmp x
1702-
if ((other->isNumber() && other->getKnownIntValue() > 0) ||
1702+
if ((other->isNumber() && other->hasKnownIntValue() && other->getKnownIntValue() > 0) ||
17031703
(!other->isNumber() && other->valueType() && other->valueType()->isIntegral() && other->valueType()->sign == ValueType::Sign::UNSIGNED)) {
17041704
bool result;
17051705
if (lhs->str() == "+")

0 commit comments

Comments
 (0)