Skip to content

Commit f13be7f

Browse files
committed
Travis: Fixed possible null pointer dereference reported by travis
1 parent a6e134e commit f13be7f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/valueflow.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,13 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
398398

399399
if (tok2->str() == "}") {
400400
if (Token::findmatch(tok2->link(), "%varid%", tok2, varid)) {
401-
if (settings->debugwarnings)
402-
bailout(tokenlist, errorLogger, tok2, "variable " + var->nameToken()->str() + " stopping on }");
401+
if (settings->debugwarnings) {
402+
std::string errmsg = "Variable ";
403+
if (var)
404+
errmsg += var->nameToken()->str() + " ";
405+
errmsg += "stopping on }";
406+
bailout(tokenlist, errorLogger, tok2, errmsg);
407+
}
403408
break;
404409
} else {
405410
tok2 = tok2->link();

0 commit comments

Comments
 (0)