Skip to content

Commit c9a04da

Browse files
committed
checkcondition.cpp: added missing hasKnownIntValue() check
1 parent 089812b commit c9a04da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/checkcondition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ void CheckCondition::checkInvalidTestForOverflow()
17001700
const Token * const other = expr->astSibling();
17011701

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

0 commit comments

Comments
 (0)