Skip to content

Commit 8416b1c

Browse files
committed
Reflection: Don't crash if closure capture type cannot be demangled
I don't have a test case, but this will address the crashes in <rdar://problem/30398155> and <rdar://problem/31961386>.
1 parent 23ded3c commit 8416b1c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ class ReflectionContext
376376
// solve the problem.
377377
while (!CaptureTypes.empty()) {
378378
const TypeRef *OrigCaptureTR = CaptureTypes[0];
379+
380+
// If we failed to demangle the capture type, we cannot proceed.
381+
if (OrigCaptureTR == nullptr)
382+
return nullptr;
383+
379384
const TypeRef *SubstCaptureTR = nullptr;
380385

381386
// If we have enough substitutions to make this captured value's

0 commit comments

Comments
 (0)