diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 2ed4adcf1..bf9b772b1 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1302,7 +1302,7 @@ bool CheckUninitVar::checkScopeForVariable(const Token *tok, const Variable& var for (const Token *tok2 = tok; tok2 && tok2 != tok->link(); tok2 = tok2->next()) { if (Token::Match(tok2, "[;{}.] %name% = - %name% ;")) varValueIf[tok2->next()->varId()] = NOT_ZERO; - if (Token::Match(tok2, "[;{}.] %name% = %num% ;")) + else if (Token::Match(tok2, "[;{}.] %name% = %num% ;")) varValueIf[tok2->next()->varId()] = (int)MathLib::toLongNumber(tok2->strAt(3)); } }