-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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(admob,android): add null checks for interstitialAd object #4670
fix(admob,android): add null checks for interstitialAd object #4670
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/invertase/react-native-firebase/54td5tojh |
Codecov Report
@@ Coverage Diff @@
## master #4670 +/- ##
=======================================
Coverage 24.06% 24.06%
=======================================
Files 109 109
Lines 3712 3712
Branches 347 347
=======================================
Hits 893 893
Misses 2611 2611
Partials 208 208 |
@Guglio95 thank you so much for posting this! I'm traveling right now and I want to give this a deeper look - sometimes a null pointer exception has the easy + correct solution of just catching it, but sometimes it means there is a much deeper assumption that is being violated and I need to study it to see which case it is :-) So it might be about a week however please don't let me get in the way of your project - if you have not already integrated patch-package you definitely should do so, and you may easily + maintainably include this in your project as a patch. If you click on the patch-package task here from the PR https://github.com/invertase/react-native-firebase/pull/4670/checks?check_run_id=1539655716 you'll see an artifacts link and in there we generate patch-package format patches for people to use while we make sure a PR is good Thanks for your patience! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very interesting - I can't understand how this would happen unless show was called before load, since the InterstitialAd object is pushed into the array here
Line 116 in 9bd0725
interstitialAdArray.put(requestId, interstitialAd); |
However, I don't see any harm in a null check here and it doesn't seem like we're hiding any deep underlying problem (at least as I understand it) so on the off-chance we catch a crash, I can merge this and hopefully you've got one less crash in your crash stats. Look for a 10.2.1 (or higher) to have it until then patch-package can get it into your project
Thanks @Guglio95
Hi @mikehardy :)
Do you think there may be something wrong with the JavaScript code I'm using? I'll double check it! Maybe there's some race condition there. Thanks Mike 👍 |
@Guglio95 yeah - all I can think is that somehow show was called before load - maybe in javascript it's a failure to await and somehow / unluckily / race-y the show call then makes it across the JS bridge before the load call, or maybe they are actually mis-ordered somehow, I'm not sure. But that seems to be what is going on to cause this stack. Always bear in mind that I may have an incorrect assumption too, that's just my hypothesis from reading the code |
I'll check my code, thank you @mikehardy ! 😄 |
Description
Hi, just got a null-pointer exception while using AdMob in my app:
I think this should sort out the issue although it was not tested.
Related issues
Found no related issue.
Release Summary
Checklist
Android
iOS
e2e
tests added or updated inpackages/\*\*/e2e
jest
tests added or updated inpackages/\*\*/__tests__
Test Plan
I simply ran the
yarn tests:jest
and compiled withyarn tests:android:build
🔥Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter