-
-
Notifications
You must be signed in to change notification settings - Fork 655
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
Buying android.test.canceled
product crashes the app
#386
Comments
Thanks for the issue with the solution. @johnmartel I hope you to give us a |
@hyochan I am working on the issue right now, I will submit a PR as soon as I can. Problem is the lib is severely lacking tests and it is hard to be sure I am not breaking anything else. |
@johnmartel Yeah. I always wish to implement some test modules but currently, I am always running out of time 😿. We'll have to check on runtime ourselves before releasing.. |
How about just checking if the PurchasesUpdatedListener purchasesUpdatedListener = new PurchasesUpdatedListener() {
@Override
public void onPurchasesUpdated(int responseCode, @Nullable List<Purchase> purchases) {
Log.d(TAG, "Purchase Updated Listener");
Log.d(TAG, "responseCode: " + responseCode);
if (responseCode != BillingClient.BillingResponse.OK) {
rejectPromisesWithBillingError(PROMISE_BUY_ITEM, responseCode);
return;
}
+ if (purchases == null) {
+ rejectPromisesWithBillingError(PROMISE_BUY_ITEM , responseCode);
+ return;
+ }
Purchase purchase = purchases.get(0);
// ...
|
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Version of react-native-iap
2.4.0-beta8
Version of react-native
0.55.4
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
Purchase promise is rejected with
E_USER_CANCELLED, "Cancelled."
Actual behavior
App crashes:
Tested environment (Emulator? Real Device?)
Real device
Steps to reproduce the behavior
android.test.canceled
onPurchasesUpdated
is invoked, a NPE is thrown at line 436Purchase purchase = purchases.get(0);
becausepurchases
is@Nullable
andnull
whileresponseCode
is 0.The text was updated successfully, but these errors were encountered: