diff --git a/framework/ios/base/executors/HippyJSExecutor.mm b/framework/ios/base/executors/HippyJSExecutor.mm index b646c3f67b6..2bc0ab487f7 100644 --- a/framework/ios/base/executors/HippyJSExecutor.mm +++ b/framework/ios/base/executors/HippyJSExecutor.mm @@ -661,7 +661,11 @@ - (void)executeBlockOnJavaScriptQueue:(dispatch_block_t)block { return; } } - auto engine = [[HippyJSEnginesMapper defaultInstance] JSEngineResourceForKey:self.enginekey]->GetEngine(); + std::shared_ptr engineRsc = [[HippyJSEnginesMapper defaultInstance] JSEngineResourceForKey:self.enginekey]; + if (!engineRsc) { + return; + } + auto engine = engineRsc->GetEngine(); if (engine) { auto runner = engine->GetJsTaskRunner(); if (footstone::Worker::IsTaskRunning() && runner == footstone::runner::TaskRunner::GetCurrentTaskRunner()) { @@ -679,7 +683,11 @@ - (void)executeAsyncBlockOnJavaScriptQueue:(dispatch_block_t)block { return; } } - auto engine = [[HippyJSEnginesMapper defaultInstance] JSEngineResourceForKey:self.enginekey]->GetEngine(); + std::shared_ptr engineRsc = [[HippyJSEnginesMapper defaultInstance] JSEngineResourceForKey:self.enginekey]; + if (!engineRsc) { + return; + } + auto engine = engineRsc->GetEngine(); if (engine) { engine->GetJsTaskRunner()->PostTask(block); }