From 6d2dd9c16d05fe3dafeea3fb7537e42e3e711e86 Mon Sep 17 00:00:00 2001 From: Levi Brown Date: Wed, 8 Mar 2017 13:42:56 -0700 Subject: [PATCH 1/2] 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. --- .../Internal/Object/Subclassing/PFObjectSubclassingController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m index 0442f71af..fcd0170dc 100644 --- a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m +++ b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m @@ -332,7 +332,7 @@ - (void)_rawRegisterSubclass:(Class)kls { - (void)_registerSubclassesInLoadedBundle:(NSBundle *)bundle { // Skip bundles that aren't loaded yet. - if (!bundle.loaded || !bundle.executablePath) { + if (![bundle isKindOfClass:NSBundle.class] || !bundle.loaded || !bundle.executablePath) { return; } // Filter out any system bundles From ff46437da12e272d3bbd4004144dac93dca1961e Mon Sep 17 00:00:00 2001 From: Levi Brown Date: Wed, 8 Mar 2017 13:43:51 -0700 Subject: [PATCH 2/2] If we encounter an unloaded bundle, log it. --- .../Internal/Object/Subclassing/PFObjectSubclassingController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m index fcd0170dc..1be108765 100644 --- a/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m +++ b/Parse/Internal/Object/Subclassing/PFObjectSubclassingController.m @@ -343,7 +343,7 @@ - (void)_registerSubclassesInLoadedBundle:(NSBundle *)bundle { } - (void)_registerSubclassesInBundle:(NSBundle *)bundle { - PFConsistencyAssert(bundle.loaded, @"Cannot register subclasses in a bundle that hasn't been loaded!"); + PFConsistencyAssert(bundle.loaded, @"Cannot register subclasses in an unloaded bundle: %@", bundle); const char *executablePath = bundle.executablePath.UTF8String; if (executablePath == NULL) {