Skip to content

Commit e0e36ca

Browse files
levigrokerflovilmart
authored andcommitted
Bundle check (#1119)
* Check for NSBundle type before sending message It seems the given `bundle` object may not be an NSBundle at times (appears to be capable of being at least an NSString), so we check to ensure the given parameter is of the expected type before we attempt to send a message with a potentially unkown selector. * If we encounter an unloaded bundle, log it.
1 parent d4974f1 commit e0e36ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ - (void)_rawRegisterSubclass:(Class)kls {
332332

333333
- (void)_registerSubclassesInLoadedBundle:(NSBundle *)bundle {
334334
// Skip bundles that aren't loaded yet.
335-
if (!bundle.loaded || !bundle.executablePath) {
335+
if (![bundle isKindOfClass:NSBundle.class] || !bundle.loaded || !bundle.executablePath) {
336336
return;
337337
}
338338
// Filter out any system bundles
@@ -343,7 +343,7 @@ - (void)_registerSubclassesInLoadedBundle:(NSBundle *)bundle {
343343
}
344344

345345
- (void)_registerSubclassesInBundle:(NSBundle *)bundle {
346-
PFConsistencyAssert(bundle.loaded, @"Cannot register subclasses in a bundle that hasn't been loaded!");
346+
PFConsistencyAssert(bundle.loaded, @"Cannot register subclasses in an unloaded bundle: %@", bundle);
347347

348348
const char *executablePath = bundle.executablePath.UTF8String;
349349
if (executablePath == NULL) {

0 commit comments

Comments
 (0)