From 0fdb3bebee7e3fa98caf333239549b28717043a8 Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Wed, 6 Jan 2010 12:16:11 +0100 Subject: [PATCH] Fixed crash when completing symbols without a valid context. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTCREATORBUG-534 Reviewed-by: Thorbjørn Lindeijer --- src/libs/cplusplus/LookupContext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 507a5d99aa7..983a705e716 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -352,8 +352,10 @@ QList LookupContext::visibleScopes(const QPair LookupContext::visibleScopes(Symbol *symbol) const { QList 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;