[Constraint system] Don't dereference a null member locator.

This commit is contained in:
Doug Gregor
2020-02-24 14:46:25 -08:00
parent f6f80befe8
commit 6cfa0b047d

View File

@@ -6068,6 +6068,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
// match, unwrap optionals and try again to allow implicit creation of
// optional "some" patterns (spelled "?").
if (result.ViableCandidates.empty() && result.UnviableCandidates.empty() &&
memberLocator &&
memberLocator->isLastElement<LocatorPathElt::PatternMatch>() &&
instanceTy->getOptionalObjectType() &&
baseObjTy->is<AnyMetatypeType>()) {