Fix issue detected by Coverity, either null pointer check is useless or there is null pointer dereference

This commit is contained in:
Daniel Marjamäki 2017-08-02 08:24:16 +02:00
parent 32422c815b
commit e977cea04c
1 changed files with 3 additions and 1 deletions

View File

@ -1055,8 +1055,10 @@ void CheckStl::string_c_str()
break;
if (!tok2 && j == i->second-1)
tok2 = tok->next()->link();
else
else if (tok2)
tok2 = tok2->previous();
else
break;
if (tok2 && Token::Match(tok2->tokAt(-4), ". c_str|data ( )")) {
const Variable* var = tok2->tokAt(-5)->variable();
if (var && var->isStlStringType()) {