Skip to content

Commit 375db9d

Browse files
authored
Merge pull request #72742 from tshortli/null-type-refinement-context
Sema: Fix null dereference in `overApproximateAvailabilityAtLocation()`
2 parents 3bc570f + 4293fa4 commit 375db9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/Sema/TypeCheckAvailability.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,9 +1375,11 @@ TypeChecker::overApproximateAvailabilityAtLocation(SourceLoc loc,
13751375
if (rootTRC) {
13761376
TypeRefinementContext *TRC =
13771377
rootTRC->findMostRefinedSubContext(loc, Context);
1378-
OverApproximateContext.constrainWith(TRC->getAvailabilityInfo());
1379-
if (MostRefined) {
1380-
*MostRefined = TRC;
1378+
if (TRC) {
1379+
OverApproximateContext.constrainWith(TRC->getAvailabilityInfo());
1380+
if (MostRefined) {
1381+
*MostRefined = TRC;
1382+
}
13811383
}
13821384
}
13831385
}

0 commit comments

Comments
 (0)