Remove assertion when current activity is null

Summary:
Assertion failure would lead to a crash, in real world not being able to start an activity shouldn't crash - usually a navigation won't happen as expected, user could try again.

Changelog:
[Android][Changed] - Don't assert on current activity when call startActivityForResult

Reviewed By: cortinico

Differential Revision: D35746652

fbshipit-source-id: 0b77ca5a69b2f3f3b0b969d84980ed8290ac9b1f
This commit is contained in:
Lulu Wu
2022-05-04 15:52:47 -07:00
committed by Facebook GitHub Bot
parent 7e7cf24200
commit bf6884dc90
@@ -457,9 +457,11 @@ public class ReactContext extends ContextWrapper {
*/
public boolean startActivityForResult(Intent intent, int code, Bundle bundle) {
Activity activity = getCurrentActivity();
Assertions.assertNotNull(activity);
activity.startActivityForResult(intent, code, bundle);
return true;
if (activity != null) {
activity.startActivityForResult(intent, code, bundle);
return true;
}
return false;
}
/**