NPE on start of the app (getTransactionDate() or getTransactionDate().toDate() is null)
prineside opened this issue · 3 comments
prineside commented
Issue details, reproduction steps/code
App crashes due to the uncaught NullPointerException at the start, probably only if user has made a purchase before
Version of gdx-pay and/or relevant dependencies
gdx-pay 1.3.2
Stacktrace
java.lang.NullPointerException
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple.transaction(PurchaseManageriOSApple.java:211)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleTransactionObserver.updatedTransactions(PurchaseManageriOSApple.java:368)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleTransactionObserver.$cb$paymentQueue$updatedTransactions$(PurchaseManageriOSApple.java)
at org.robovm.apple.uikit.UIApplication.main(Native Method)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java:446)
Please select the affected platforms and payment service implementation
- Amazon
- googlebilling
- googlepay
- apple robovm
- Huawei
MrStahlfelge commented
Must be getTransactionDate() that returns null. But the line is seven years old, I wonder why we didn't encounter problems before.
prineside commented
Maybe one of the iOS updates has changed something. I've received more than a dozen of reports from different users referring to this exception
If transaction date is not critical for the library, checking for null and using current time as a fallback should be sufficient
MrStahlfelge commented
That should be a good solution. Can you provide a PR?