Skip to content

Commit f6e471c

Browse files
committed
refs #12861 - exit early in ConditionHandler::traverseCondition()
1 parent fea194b commit f6e471c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/valueflow.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4604,11 +4604,15 @@ struct ConditionHandler {
46044604
if (Token::Match(tok, ":|;|,"))
46054605
continue;
46064606

4607+
std::vector<Condition> conditions = parse(tok, settings);
4608+
if (conditions.empty())
4609+
continue;
4610+
46074611
const Token* top = tok->astTop();
46084612

46094613
if (!Token::Match(top->previous(), "if|while|for (") && !Token::Match(tok->astParent(), "&&|%oror%|?|!"))
46104614
continue;
4611-
for (const Condition& cond : parse(tok, settings)) {
4615+
for (const Condition& cond : conditions) {
46124616
if (!cond.vartok)
46134617
continue;
46144618
if (cond.vartok->exprId() == 0)

0 commit comments

Comments
 (0)