Skip to content

Commit 1e7c80f

Browse files
committed
fix
1 parent 474a09b commit 1e7c80f

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/checkfunctions.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,12 @@ static const Token *checkMissingReturnScope(const Token *tok, const Library &lib
386386
if (!isExhaustiveSwitch(tok->link()))
387387
return tok->link();
388388
} else if (tok->scope()->type == ScopeType::eIf) {
389-
const Token *condition = tok->scope()->classDef->next()->astOperand2();
389+
const Token *paren = tok->link()->linkAt(-1);
390+
if (!paren || !Token::simpleMatch(paren->astOperand1(), "if")) {
391+
tok = tok->link();
392+
continue;
393+
}
394+
const Token *condition = paren->astOperand2();
390395
if (condition && condition->hasKnownIntValue() && condition->getKnownIntValue() == 1)
391396
return checkMissingReturnScope(tok, library);
392397
return tok;

0 commit comments

Comments
 (0)