Skip to content

Commit 9c927a6

Browse files
authored
Merge pull request #26154 from rintaro/5.1-ide-completion-checkhasinterfacety-rdar51599533
[5.1][CodeCompletion] Add defensive nullptr check
2 parents 7b90512 + 7c7f726 commit 9c927a6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/IDE/ExprContextAnalysis.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,15 @@ bool collectPossibleCalleesForApply(
415415

416416
if (auto *DRE = dyn_cast<DeclRefExpr>(fnExpr)) {
417417
if (auto *decl = DRE->getDecl()) {
418-
auto declType = decl->getInterfaceType();
419-
if (auto *funcType = declType->getAs<AnyFunctionType>())
420-
candidates.emplace_back(funcType, decl);
418+
if (decl->hasInterfaceType())
419+
if (auto *funcType = decl->getInterfaceType()->getAs<AnyFunctionType>())
420+
candidates.emplace_back(funcType, decl);
421421
}
422422
} else if (auto *OSRE = dyn_cast<OverloadSetRefExpr>(fnExpr)) {
423423
for (auto *decl : OSRE->getDecls()) {
424-
auto declType = decl->getInterfaceType();
425-
if (auto *funcType = declType->getAs<AnyFunctionType>())
426-
candidates.emplace_back(funcType, decl);
424+
if (decl->hasInterfaceType())
425+
if (auto *funcType = decl->getInterfaceType()->getAs<AnyFunctionType>())
426+
candidates.emplace_back(funcType, decl);
427427
}
428428
} else if (auto *UDE = dyn_cast<UnresolvedDotExpr>(fnExpr)) {
429429
collectPossibleCalleesByQualifiedLookup(

0 commit comments

Comments
 (0)