Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NullPointerException in NavigationModule #7815

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Wiingaard
Copy link

@Wiingaard Wiingaard commented Nov 20, 2023

We're seeing a crash that affects ~1% of our user base per month, that's caused by:

NullPointerException
Attempt to invoke virtual method 'boolean android.app.Activity.isFinishing()' on a null object reference

After looking into the code, we realised that that the null check and .isFinishing() are not referencing the same activity.

Here's a screenshot with stack trace from Sentry:
Screenshot 2023-11-20 at 14 38 24

@Wiingaard Wiingaard marked this pull request as ready for review November 20, 2023 13:35
@@ -223,7 +223,8 @@ private Options parse(@Nullable ReadableMap mergeOptions) {

protected void handle(Runnable task) {
UiThread.post(() -> {
if (getCurrentActivity() != null && !activity().isFinishing()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how it's a different activity, activity() returns getCurrentActivity(). wdyt?

Copy link

stale bot commented Mar 17, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the 🏚 stale label Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants