diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 0e8d07fb7..e66c9f310 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -1332,7 +1332,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, "[;{}.] %var% = - %name% ;")) varValueElse[tok2->next()->varId()] = NOT_ZERO; - if (Token::Match(tok2, "[;{}.] %var% = %num% ;")) + else if (Token::Match(tok2, "[;{}.] %var% = %num% ;")) varValueElse[tok2->next()->varId()] = (int)MathLib::toLongNumber(tok2->strAt(3)); } }