Skip to content

Commit 156b9bb

Browse files
committed
fix a crash on invalid caught by the validation tests.
1 parent 62e4811 commit 156b9bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/AST/NameLookup.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
423423
// implicitly doing a static lookup into the parent declcontext.
424424
if (auto *PBI = dyn_cast<PatternBindingInitializer>(DC))
425425
if (!DC->getParent()->isModuleScopeContext()) {
426-
auto PBD = PBI->getBinding();
427-
isTypeLookup = PBD->isStatic();
428-
DC = DC->getParent();
426+
if (auto PBD = PBI->getBinding()) {
427+
isTypeLookup = PBD->isStatic();
428+
DC = DC->getParent();
429+
}
429430
}
430431

431432
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(DC)) {

0 commit comments

Comments
 (0)