Skip to content

Commit 273c9a7

Browse files
authored
Fix crash when switching bundles in playground (#15478)
1 parent b39b43d commit 273c9a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/playground/windows/playground-composition/Playground-Composition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ struct WindowData {
228228
}
229229

230230
void UpdateViewOptions() {
231-
if (!m_appName)
231+
if (!m_appName || !m_compRootView)
232232
return;
233233

234234
winrt::Microsoft::ReactNative::ReactViewOptions viewOptions;
@@ -263,12 +263,12 @@ struct WindowData {
263263
winrt::Microsoft::ReactNative::ReactCoreInjection::SetTopLevelWindowId(
264264
host.InstanceSettings().Properties(), reinterpret_cast<uint64_t>(hwnd));
265265

266+
// Nudge the ReactNativeHost to create the instance and wrapping context
267+
host.ReloadInstance();
268+
266269
for (auto &window : g_windows) {
267270
window->UpdateViewOptions();
268271
}
269-
270-
// Nudge the ReactNativeHost to create the instance and wrapping context
271-
host.ReloadInstance();
272272
}
273273

274274
break;

0 commit comments

Comments
 (0)