Commit b8e7a98a authored by Roberto Raggi's avatar Roberto Raggi Committed by con

Fixed possible crash when completing function-like arguments.

(cherry picked from commit 85c501c9)
parent 95b8f1d9
......@@ -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);
}
......
......@@ -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();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment