Skip to content

Commit f5bd65a

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 (cherry picked from commit fedf24c)
1 parent 2a6d271 commit f5bd65a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3429,7 +3429,9 @@ ImportedType ClangImporter::Implementation::importAccessorParamsAndReturnType(
34293429
// FIXME: Duplicated from importMethodParamsAndReturnType.
34303430
DeclContext *origDC = importDeclContextOf(property,
34313431
property->getDeclContext());
3432-
assert(origDC);
3432+
if (!origDC)
3433+
return {Type(), false};
3434+
34333435
auto fieldType = isGetter ? clangDecl->getReturnType()
34343436
: clangDecl->getParamDecl(0)->getType();
34353437

0 commit comments

Comments
 (0)