diff --git a/framework/ios/base/bridge/HippyBridge.mm b/framework/ios/base/bridge/HippyBridge.mm index fe6246a9d34..8a7d72e16d6 100644 --- a/framework/ios/base/bridge/HippyBridge.mm +++ b/framework/ios/base/bridge/HippyBridge.mm @@ -442,8 +442,9 @@ - (void)setUp { _javaScriptExecutor.contextCreatedBlock = ^(){ __strong __typeof(weakSelf)strongSelf = weakSelf; - if (strongSelf) { - dispatch_semaphore_wait(strongSelf.moduleSemaphore, DISPATCH_TIME_FOREVER); + dispatch_semaphore_t moduleSemaphore = strongSelf.moduleSemaphore; + if (strongSelf.isValid && moduleSemaphore) { + dispatch_semaphore_wait(moduleSemaphore, DISPATCH_TIME_FOREVER); NSDictionary *nativeModuleConfig = [strongSelf nativeModuleConfig]; [strongSelf.javaScriptExecutor injectObjectSync:nativeModuleConfig asGlobalObjectNamed:kHippyBatchedBridgeConfigKey callback:nil]; @@ -1085,7 +1086,6 @@ - (void)invalidate { _displayLink = nil; _moduleSetup = nil; _startTime = footstone::TimePoint::SystemNow(); - self.moduleSemaphore = nil; dispatch_group_notify(group, dispatch_get_main_queue(), ^{ [jsExecutor executeBlockOnJavaScriptQueue:^{