Skip to content

Commit d62b941

Browse files
committed
fix: add reactInstance condition in onHostDestroy
1 parent 13a5260 commit d62b941

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,10 @@ public void onHostDestroy() {
149149
if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {
150150
mReactHost.onHostDestroy(mActivity);
151151
} else {
152-
if (getReactNativeHost().hasInstance()) {
153-
getReactNativeHost().getReactInstanceManager().onHostDestroy(mActivity);
152+
if (getReactNativeHost() != null) {
153+
if (getReactNativeHost().hasInstance() && getReactNativeHost().getReactInstanceManager() != null) {
154+
getReactNativeHost().getReactInstanceManager().onHostDestroy(mActivity);
155+
}
154156
}
155157
}
156158
}
@@ -311,9 +313,9 @@ public void unloadApp() {
311313
mReactSurface = null;
312314
}
313315
} else {
314-
if (mReactRootView != null) {
315-
mReactRootView.unmountReactApplication();
316-
mReactRootView = null;
316+
if (this.mReactRootView != null) {
317+
this.mReactRootView.unmountReactApplication();
318+
this.mReactRootView = null;
317319
}
318320
}
319321
}

0 commit comments

Comments
 (0)