Travis: Fixed possible null pointer dereference reported by travis

This commit is contained in:
Daniel Marjamäki 2014-04-02 19:08:44 +02:00
parent a6e134e811
commit f13be7fb6c
1 changed files with 7 additions and 2 deletions

View File

@ -398,8 +398,13 @@ static void valueFlowBeforeCondition(TokenList *tokenlist, ErrorLogger *errorLog
if (tok2->str() == "}") {
if (Token::findmatch(tok2->link(), "%varid%", tok2, varid)) {
if (settings->debugwarnings)
bailout(tokenlist, errorLogger, tok2, "variable " + var->nameToken()->str() + " stopping on }");
if (settings->debugwarnings) {
std::string errmsg = "Variable ";
if (var)
errmsg += var->nameToken()->str() + " ";
errmsg += "stopping on }";
bailout(tokenlist, errorLogger, tok2, errmsg);
}
break;
} else {
tok2 = tok2->link();