Fixed possible crash when completing function-like arguments.

(cherry picked from commit 85c501c976)
This commit is contained in:
Roberto Raggi
2009-07-09 16:20:20 +02:00
committed by con
parent 95b8f1d9c5
commit b8e7a98ada
2 changed files with 3 additions and 3 deletions

View File

@@ -667,7 +667,7 @@ ResolveExpression::resolveMemberExpression(const QList<Result> &baseResults,
if (NamedType *namedTy = ty->asNamedType())
results += resolveMember(p, memberName, namedTy);
else if (Function *fun = ty->asFunctionType()) {
if (fun->scope()->isBlockScope() || fun->scope()->isNamespaceScope()) {
if (fun->scope() && (fun->scope()->isBlockScope() || fun->scope()->isNamespaceScope())) {
ty = fun->returnType();
if (ReferenceType *refTy = ty->asReferenceType())
@@ -881,7 +881,7 @@ QList<Symbol *> ResolveClass::resolveClass(NamedType *namedTy,
if (Function *funTy = decl->type()->asFunctionType()) {
// QString foo("ciao");
// foo.
if (funTy->scope()->isBlockScope() || funTy->scope()->isNamespaceScope()) {
if (funTy->scope() && (funTy->scope()->isBlockScope() || funTy->scope()->isNamespaceScope())) {
const ResolveExpression::Result r(funTy->returnType(), decl);
resolvedSymbols += resolveClass(r, context);
}

View File

@@ -932,7 +932,7 @@ bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &re
namedTy = ty->asNamedType();
if (! namedTy) {
Function *fun = ty->asFunctionType();
if (fun && (fun->scope()->isBlockScope() || fun->scope()->isNamespaceScope()))
if (fun && fun->scope() && (fun->scope()->isBlockScope() || fun->scope()->isNamespaceScope()))
namedTy = fun->returnType()->asNamedType();
}
}