forked from qt-creator/qt-creator
Fixed possible crash when completing function-like arguments.
(cherry picked from commit 85c501c976
)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user