diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 5c2f9020b..e14740b10 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -915,11 +915,10 @@ Function* SymbolDatabase::addGlobalFunction(Scope*& scope, const Token*& tok, co function->token = funcStart; function->hasBody = true; - Scope* old_scope = scope; addNewFunction(&scope, &tok); if (scope) { - scope->function = &old_scope->functionList.back(); + scope->function = function; return function; } return 0;