diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 70fa4d9ae33..bc1df36aacc 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -716,7 +716,7 @@ void CheckCondition::multiCondition2() // Condition.. const Token *cond2 = tok->str() == "if" ? condStartToken->astOperand2() : condStartToken->astOperand1(); - const bool isReturnVar = (tok->str() == "return" && !Token::Match(cond2, "%cop%")); + const bool isReturnVar = (tok->str() == "return" && (!Token::Match(cond2, "%cop%") || (cond2 && cond2->isUnaryOp("!")))); ErrorPath errorPath;