Skip to content

Commit 503f487

Browse files
committed
Check if decl context returned by importDeclContextOf is null
I've seen a crash due to importDeclContextOf returning a null decl context in importAccessorParamsAndReturnType. Most other call sites of importDeclContextOf check the returned value, so add a check in importAccessorParamsAndReturnType too. rdar://127847162
1 parent 75d60af commit 503f487

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,9 @@ ImportedType ClangImporter::Implementation::importAccessorParamsAndReturnType(
34303430
DeclContext *origDC = importDeclContextOf(property,
34313431
property->getDeclContext());
34323432
assert(origDC);
3433+
if (!origDC)
3434+
return {Type(), false};
3435+
34333436
auto fieldType = isGetter ? clangDecl->getReturnType()
34343437
: clangDecl->getParamDecl(0)->getType();
34353438

0 commit comments

Comments
 (0)