From 8a4ac585a13798eba221c67c248737e6f789d169 Mon Sep 17 00:00:00 2001 From: Jon Thysell Date: Tue, 27 Aug 2024 13:14:53 -0700 Subject: [PATCH] [0.74] [Fabric] Fixes a crash that happens on release builds (#13619) Backport of PR #13573 to 0.74. * [Fabric] Fixes a crash that happens on release builds * Change files Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com> --- ...ative-windows-a4b5f206-f251-4c85-b2a4-0f1aaf4e8763.json | 7 +++++++ vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 change/react-native-windows-a4b5f206-f251-4c85-b2a4-0f1aaf4e8763.json diff --git a/change/react-native-windows-a4b5f206-f251-4c85-b2a4-0f1aaf4e8763.json b/change/react-native-windows-a4b5f206-f251-4c85-b2a4-0f1aaf4e8763.json new file mode 100644 index 00000000000..868f6ff1976 --- /dev/null +++ b/change/react-native-windows-a4b5f206-f251-4c85-b2a4-0f1aaf4e8763.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "[0.74] [Fabric] Fixes a crash that happens on release builds", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp index 33aad10d8b7..e6d3e24117b 100644 --- a/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +++ b/vnext/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp @@ -657,7 +657,8 @@ void ReactInstanceWin::InitializeBridgeless() noexcept { facebook::react::ReactInstance::JSRuntimeFlags options; m_bridgelessReactInstance->initializeRuntime(options, [=](facebook::jsi::Runtime &runtime) { auto logger = [loggingHook = GetLoggingCallback()](const std::string &message, unsigned int logLevel) { - loggingHook(static_cast(logLevel), message.c_str()); + if (loggingHook) + loggingHook(static_cast(logLevel), message.c_str()); }; facebook::react::bindNativeLogger(runtime, logger);