Skip to content

Commit

Permalink
Remove assertion when current activity is null
Browse files Browse the repository at this point in the history
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
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed May 4, 2022
1 parent 7e7cf24 commit bf6884d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,11 @@ public boolean hasCurrentActivity() {
*/
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;
}

/**
Expand Down

0 comments on commit bf6884d

Please sign in to comment.