Skip to content

Commit f397f2b

Browse files
committed
Add a defensive nullptr check.
ASTContext::get##NAME##Type() can return an empty type and we have LLDB crash logs that show this can really happen. rdar://74503567 (cherry picked from commit 9c8f325)
1 parent b19c4d0 commit f397f2b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,8 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
23022302
if (kind == SpecialMethodKind::NSDictionarySubscriptGetter &&
23032303
paramTy->isObjCIdType()) {
23042304
swiftParamTy = SwiftContext.getNSCopyingType();
2305+
if (!swiftParamTy)
2306+
return {Type(), false};
23052307
if (optionalityOfParam != OTK_None)
23062308
swiftParamTy = OptionalType::get(swiftParamTy);
23072309

0 commit comments

Comments
 (0)