diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 507a5d99aa7439442dd82d4a16815a7234d4a206..983a705e7161effa1ef3081a633526586b32c33a 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -352,8 +352,10 @@ QList<Scope *> LookupContext::visibleScopes(const QPair<FullySpecifiedType, Symb
 QList<Scope *> LookupContext::visibleScopes(Symbol *symbol) const
 {
     QList<Scope *> scopes;
-    for (Scope *scope = symbol->scope(); scope; scope = scope->enclosingScope())
-        scopes.append(scope);
+    if (symbol) {
+        for (Scope *scope = symbol->scope(); scope; scope = scope->enclosingScope())
+            scopes.append(scope);
+    }
     scopes += visibleScopes();
     scopes = expand(scopes);
     return scopes;