We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b884698 + d3ef6f7 commit 79cd818Copy full SHA for 79cd818
stdlib/public/runtime/Metadata.cpp
@@ -286,6 +286,11 @@ static SimpleGlobalCache<ObjCClassCacheEntry> ObjCClassWrappers;
286
287
const Metadata *
288
swift::swift_getObjCClassMetadata(const ClassMetadata *theClass) {
289
+ // Make calls resilient against receiving a null Objective-C class. This can
290
+ // happen when classes are weakly linked and not available.
291
+ if (theClass == nullptr)
292
+ return nullptr;
293
+
294
// If the class pointer is valid as metadata, no translation is required.
295
if (theClass->isTypeMetadata()) {
296
return theClass;
0 commit comments