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

Add unhandled exception to TabNavigatorObserver catch block #6902

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

szydlovsky
Copy link
Contributor

Summary

Fixes #6724

Turns out that TabNavigatorObserver's onFragmentUpdate didn't handle NullPointerException, which in turn sometimes crashed release builds on android.

Test plan

I wasn't able to create a simple reproduction but I have at least one SWM project that used the exact same code to patch Reanimated and it took care of their android crashes.

@szydlovsky szydlovsky force-pushed the @szydlovsky/fix-unhandled-java-excption branch from ae8b7a8 to 5732a49 Compare January 15, 2025 13:03
@tomekzaw
Copy link
Member

tomekzaw commented Jan 15, 2025

Do we know which line of code exactly causes NullPointerException? If yes, perhaps we should rather add an if (obj != null) since catch (NullPointerException e) is usually the last resort.

On the other hand, if this works (and also handles other types of exceptions) then maybe we shouldn't waste more time on debugging that and simply shift the PR in its current form.

@szydlovsky
Copy link
Contributor Author

@tomekzaw exactly my sentiment. I'd rather not meddle in the code risking getting something broken if a simple exception handling is enough

@szydlovsky
Copy link
Contributor Author

Update: got community confirmation that it fixes the issue: #6724 (comment)

@tomekzaw tomekzaw added this pull request to the merge queue Jan 23, 2025
Merged via the queue into main with commit d821b16 Jan 23, 2025
11 checks passed
@tomekzaw tomekzaw deleted the @szydlovsky/fix-unhandled-java-excption branch January 23, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on Android production - Error: Exception in HostFunction: java.lang.NullPointerException
2 participants