From b02d705ac4f4fb256c3d92340720e4fb972ba0f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Thu, 26 Nov 2009 16:22:03 +0100
Subject: [PATCH] Fixed possible crash in the code completion

Null pointer reference in a case where the global namespace is
explicitly specified using ::

Task-number: QTCREATORBUG-351
Review-pending-by: Roberto Raggi
---
 src/libs/cplusplus/LookupContext.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp
index 4d3ed932759..507a5d99aa7 100644
--- a/src/libs/cplusplus/LookupContext.cpp
+++ b/src/libs/cplusplus/LookupContext.cpp
@@ -513,8 +513,8 @@ void LookupContext::expandFunction(Function *function,
                                                         q->isGlobal());
         const QList<Symbol *> candidates = resolveClassOrNamespace(nestedNameSpec, visibleScopes);
         for (int j = 0; j < candidates.size(); ++j) {
-            expand(candidates.at(j)->asScopedSymbol()->members(),
-                   visibleScopes, expandedScopes);
+            if (ScopedSymbol *scopedSymbol = candidates.at(j)->asScopedSymbol())
+                expand(scopedSymbol->members(), visibleScopes, expandedScopes);
         }
     }
 }
-- 
GitLab