From a7cda431f03ecf7cf26bfb97353491fe74316326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Wed, 11 Feb 2009 10:31:38 +0100 Subject: [PATCH] Fixed crash in lookup context due to null-name Return early in this case. Reviewed-by: Roberto Raggi --- src/libs/cplusplus/LookupContext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 01d4e13b4eb..e130aa1bd54 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -159,8 +159,12 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol, QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visibleScopes, ResolveMode mode) const { + QList<Symbol *> candidates; + + if (!name) + return candidates; + if (QualifiedNameId *q = name->asQualifiedNameId()) { - QList<Symbol *> candidates; QList<Scope *> scopes = visibleScopes; for (unsigned i = 0; i < q->nameCount(); ++i) { Name *name = q->nameAt(i); @@ -210,7 +214,6 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible return candidates; } - QList<Symbol *> candidates; if (Identifier *id = identifier(name)) { for (int scopeIndex = 0; scopeIndex < visibleScopes.size(); ++scopeIndex) { Scope *scope = visibleScopes.at(scopeIndex); -- GitLab