Skip to content

Commit 3601cc0

Browse files
authored
Merge pull request #25876 from rintaro/ide-completion-checkhasinterfacety-rdar51599533
[CodeCompletion] Add defensive nullptr check
2 parents bf6b01d + 8c8b89c commit 3601cc0

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
@@ -368,15 +368,15 @@ static bool collectPossibleCalleesForApply(
368368

369369
if (auto *DRE = dyn_cast<DeclRefExpr>(fnExpr)) {
370370
if (auto *decl = DRE->getDecl()) {
371-
auto declType = decl->getInterfaceType();
372-
if (auto *funcType = declType->getAs<AnyFunctionType>())
373-
candidates.emplace_back(funcType, decl);
371+
if (decl->hasInterfaceType())
372+
if (auto *funcType = decl->getInterfaceType()->getAs<AnyFunctionType>())
373+
candidates.emplace_back(funcType, decl);
374374
}
375375
} else if (auto *OSRE = dyn_cast<OverloadSetRefExpr>(fnExpr)) {
376376
for (auto *decl : OSRE->getDecls()) {
377-
auto declType = decl->getInterfaceType();
378-
if (auto *funcType = declType->getAs<AnyFunctionType>())
379-
candidates.emplace_back(funcType, decl);
377+
if (decl->hasInterfaceType())
378+
if (auto *funcType = decl->getInterfaceType()->getAs<AnyFunctionType>())
379+
candidates.emplace_back(funcType, decl);
380380
}
381381
} else if (auto *UDE = dyn_cast<UnresolvedDotExpr>(fnExpr)) {
382382
collectPossibleCalleesByQualifiedLookup(

0 commit comments

Comments
 (0)