From 6ba316595fc790e835a2d2c8b1c5565650338b09 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Sat, 16 Sep 2023 14:05:07 +0200 Subject: [PATCH] Variable shadowing --- lib/symboldatabase.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 8e6a145c834..86e827512ee 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -5045,15 +5045,12 @@ const Enumerator * SymbolDatabase::findEnumerator(const Token * tok, std::setfunctionOf) { - temp = scope->functionOf->findRecordInNestedList(tok1->str()); - } - if (temp) { + if (scope->functionOf && (temp = scope->functionOf->findRecordInNestedList(tok1->str()))) { scope = temp; } else { // find first scope while (scope && scope->nestedIn) { - const Scope * temp = scope->nestedIn->findRecordInNestedList(tok1->str()); + temp = scope->nestedIn->findRecordInNestedList(tok1->str()); if (temp) { scope = temp; break;