diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp
index 2abaf72ef21ac7b02cf6c1339e5217d1f12132b0..e5ba35d75d661b26523e93168bf48a9fbea0246b 100644
--- a/src/libs/cplusplus/CppDocument.cpp
+++ b/src/libs/cplusplus/CppDocument.cpp
@@ -401,7 +401,9 @@ void Document::setGlobalNamespace(Namespace *globalNamespace)
 Scope *Document::scopeAt(unsigned line, unsigned column)
 {
     FindScopeAt findScopeAt(_translationUnit, line, column);
-    return findScopeAt(_globalNamespace);
+    if (Scope *scope = findScopeAt(_globalNamespace))
+        return scope;
+    return globalSymbols();
 }
 
 Symbol *Document::findSymbolAt(unsigned line, unsigned column) const