From 990971186fccf1e14c8715cb35ab82ad8e43f99c Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 4 Apr 2023 09:40:57 -0700 Subject: [PATCH] Fix a crash new app template when `createRootView` is invoked with null bundle (#36796) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36796 As the title says, this fixes a instacrash on template when `createRootView` is invoked with a bundle being null. The crash was happening as the parameter, despite being not used, is specified as `Bundle` and is not nullable. When the Java caller passes `null`, the app crashes. Changelog: [Android] [Fixed] - Fix a crash new app template when `createRootView` is invoked with null bundle Reviewed By: cipolleschi Differential Revision: D44668305 fbshipit-source-id: 1150ddac26f19765e7340878c8850d8462c6f3fd --- .../com/facebook/react/defaults/DefaultReactActivityDelegate.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt index 0a560c23213cfb..a73565f35a977f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt @@ -45,6 +45,6 @@ open class DefaultReactActivityDelegate( override fun createRootView(): ReactRootView = ReactRootView(context).apply { setIsFabric(fabricEnabled) } - override fun createRootView(bundle: Bundle): ReactRootView = + override fun createRootView(bundle: Bundle?): ReactRootView = ReactRootView(context).apply { setIsFabric(fabricEnabled) } }