Fix CID 1378763
Defensive check recovered from earlier version of this code
This commit is contained in:
parent
7e823e6d8e
commit
d7b91a9e92
|
@ -1668,10 +1668,11 @@ void CheckOther::zerodivError(const Token *tok, const ValueFlow::Value *value)
|
|||
const ErrorPath errorPath = getErrorPath(tok, value, "Division by zero");
|
||||
|
||||
std::ostringstream errmsg;
|
||||
if (value->condition)
|
||||
if (value->condition) {
|
||||
unsigned int line = tok ? tok->linenr() : 0;
|
||||
errmsg << ValueFlow::eitherTheConditionIsRedundant(value->condition)
|
||||
<< " or there is division by zero at line " << tok->linenr() << ".";
|
||||
else
|
||||
<< " or there is division by zero at line " << line << ".";
|
||||
} else
|
||||
errmsg << "Division by zero.";
|
||||
|
||||
reportError(errorPath,
|
||||
|
|
Loading…
Reference in New Issue