create fallback contextContainer (#37441)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37441

Changelog: [Internal]

i just noticed that `[_delegate createContextContainer]` can be null because it returns `shared_ptr`, we should protect against that!

Reviewed By: javache

Differential Revision: D45805196

fbshipit-source-id: 645815812da1718e1025c7e6b2763e698d86b59a
This commit is contained in:
Phillip Pan
2023-05-15 15:05:16 -07:00
committed by Facebook GitHub Bot
parent a6c658ff69
commit 11251c3db0
@@ -237,6 +237,9 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
RCTLogSetBridgelessCallableJSModules(_bridgeModuleDecorator.callableJSModules);
auto contextContainer = [_delegate createContextContainer];
if (!contextContainer) {
contextContainer = std::make_shared<ContextContainer>();
}
contextContainer->insert(
"RCTImageLoader", facebook::react::wrapManagedObject([_turboModuleManager moduleForName:"RCTImageLoader"]));
contextContainer->insert(