-
Notifications
You must be signed in to change notification settings - Fork 53
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 null intent crash #430
Conversation
This pull request has been linked to Shortcut Story #11657: [Android] Null check for activity.intent before launching billing flow. |
@@ -222,6 +223,10 @@ class BillingWrapper( | |||
activity: Activity, | |||
params: BillingFlowParams | |||
) { | |||
if (activity.intent == null) { | |||
activity.intent = Intent() |
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.
Looks like devs might be setting the intent to null intentionally #381 (comment), so I wonder if this will have unintended consequences for this developer.
Maybe we can ask them?
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.
asked!
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.
with "always be shipping" in mind, i've reverted the "fix" and just left the log. we can consider setting to a null intent once we hear back.
seems like a react-native plugin also sets the intent to null, and someone posted a fix: ajith-ab/react-native-receive-sharing-intent#110 (comment)
but i still don't feel confident whether that could lead to unwanted side effects. i thought about if we could set it to Intent() before calling launchBillingFlow
, and then set it back to null after (if it was null)? still probably not foolproof though...
045ebf8
to
cd39770
Compare
This reverts commit cd39770.
Fixes [sc-11657]
Related issues:
#381
community post
BillingClient expects that the Activity passed into
launchBillingFlow
has a non-null intent. The fix is to detect a null intent and pass a new one in.I'm unsure whether setting an empty intent could have unwanted side effects...maybe we want to only log here.