diff --git a/change/react-native-windows-7a98fbf7-0186-4130-b6ab-409caa188bee.json b/change/react-native-windows-7a98fbf7-0186-4130-b6ab-409caa188bee.json new file mode 100644 index 00000000000..b86d2e83c9b --- /dev/null +++ b/change/react-native-windows-7a98fbf7-0186-4130-b6ab-409caa188bee.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Fix crash attempting to get runtime when shutting down instance", + "packageName": "react-native-windows", + "email": "30809111+acoates-ms@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h index e9afcef5b23..a0314573c63 100644 --- a/vnext/Microsoft.ReactNative.Cxx/NativeModules.h +++ b/vnext/Microsoft.ReactNative.Cxx/NativeModules.h @@ -527,7 +527,8 @@ struct ModuleJsiInitMethodInfo(module), method]( ReactContext const &reactContext, winrt::Windows::Foundation::IInspectable const &runtimeHandle) noexcept { - (module->*method)(reactContext, GetOrCreateContextRuntime(reactContext, runtimeHandle)); + if (runtimeHandle) + (module->*method)(reactContext, GetOrCreateContextRuntime(reactContext, runtimeHandle)); }; } };