Skip to content

Commit

Permalink
Only call finish on Android activity if not null
Browse files Browse the repository at this point in the history
  • Loading branch information
poltak committed May 20, 2024
1 parent f0e9cd9 commit f872d87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public String getName() {

@ReactMethod
public void close() {
getCurrentActivity().finish();
Activity currentActivity = getCurrentActivity();
if (currentActivity != null) {
currentActivity.finish();
}
}

@ReactMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ protected WritableMap processIntent() {
@ReactMethod
public void close() {
Activity currentActivity = getCurrentActivity();

currentActivity.finish();
if (currentActivity != null) {
currentActivity.finish();
}
}

public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { }
Expand Down

0 comments on commit f872d87

Please sign in to comment.