Skip to content

Commit 47af2cf

Browse files
committed
refs #12861 - exit early in ConditionHandler::traverseCondition()
1 parent 39f3a75 commit 47af2cf

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
@@ -4602,11 +4602,15 @@ struct ConditionHandler {
46024602
if (Token::Match(tok, ":|;|,"))
46034603
continue;
46044604

4605+
std::vector<Condition> conditions = parse(tok, settings);
4606+
if (conditions.empty())
4607+
continue;
4608+
46054609
const Token* top = tok->astTop();
46064610

46074611
if (!Token::Match(top->previous(), "if|while|for (") && !Token::Match(tok->astParent(), "&&|%oror%|?|!"))
46084612
continue;
4609-
for (const Condition& cond : parse(tok, settings)) {
4613+
for (const Condition& cond : conditions) {
46104614
if (!cond.vartok)
46114615
continue;
46124616
if (cond.vartok->exprId() == 0)

0 commit comments

Comments
 (0)