Fixed crash in lookup context due to null-name

Return early in this case.

Reviewed-by: Roberto Raggi
This commit is contained in:
Thorbjørn Lindeijer
2009-02-11 10:31:38 +01:00
parent 9a5e1918a1
commit a7cda431f0

View File

@@ -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);