iOS: fixed RCTDevSettings executor-override handling

Summary: RCTDevSettings incorrectly assigned "bad" executor-override class to the executor instead of checking if the class exists before assigning it. It should really check if the class exists, and fallback to defaults otherwise.

Reviewed By: mmmulani, yungsters

Differential Revision: D4655926

fbshipit-source-id: 48c8fe28f22aaa8430752411ce5e6e858dbd4b32
This commit is contained in:
Kevin Gozali 2017-03-04 16:42:55 -08:00 committed by Facebook Github Bot
parent 7e2d7f0c98
commit c04e79e85a

View File

@ -228,8 +228,9 @@ RCT_EXPORT_METHOD(setIsDebuggingRemotely:(BOOL)enabled)
{ {
// This value is passed as a command-line argument, so fall back to reading from NSUserDefaults directly // This value is passed as a command-line argument, so fall back to reading from NSUserDefaults directly
NSString *executorOverride = [[NSUserDefaults standardUserDefaults] stringForKey:kRCTDevSettingExecutorOverrideClass]; NSString *executorOverride = [[NSUserDefaults standardUserDefaults] stringForKey:kRCTDevSettingExecutorOverrideClass];
if (executorOverride) { Class executorOverrideClass = executorOverride ? NSClassFromString(executorOverride) : nil;
self.executorClass = NSClassFromString(executorOverride); if (executorOverrideClass) {
self.executorClass = executorOverrideClass;
} else { } else {
BOOL enabled = self.isRemoteDebuggingAvailable && self.isDebuggingRemotely; BOOL enabled = self.isRemoteDebuggingAvailable && self.isDebuggingRemotely;
self.executorClass = enabled ? objc_getClass("RCTWebSocketExecutor") : nil; self.executorClass = enabled ? objc_getClass("RCTWebSocketExecutor") : nil;