Fix suspicious code found by Coverity, dont check if scope->function is null and then dereference it

This commit is contained in:
Daniel Marjamäki 2017-08-01 13:26:35 +02:00
parent 058c439b2a
commit 1758c3b4e7
1 changed files with 2 additions and 2 deletions

View File

@ -3945,9 +3945,9 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
const Scope * scope = tok->scope();
// check if this function is a member function
if (scope && scope->functionOf && scope->functionOf->isClassOrStruct()) {
if (scope && scope->functionOf && scope->functionOf->isClassOrStruct() && scope->function) {
// check if isConst mismatches
if (!(scope->function && scope->function->isConst() == func->isConst())) {
if (scope->function->isConst() != func->isConst()) {
if (scope->function->isConst()) {
if (!erased)
++i;