From 1758c3b4e7136f91d06f66e48bd6910ddd18db22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 1 Aug 2017 13:26:35 +0200 Subject: [PATCH] Fix suspicious code found by Coverity, dont check if scope->function is null and then dereference it --- lib/symboldatabase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 8c8fc5b3e..34124c420 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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;