paypal / paypal-here-sdk-ios-distribution

Add credit card (tap, insert, swipe & key-in) capabilities to your iOS app
Other
82 stars 91 forks source link

SDK crashing when completion handler set to `nil` #319

Open charlieMonroe opened 4 years ago

charlieMonroe commented 4 years ago

While the SDK declares nullability for various completion handlers as nullable, the reality is that the SDK crashes if nil is passed.

For example:

PayPalRetailSDK.deviceManager()!.getActiveReader()?.disconnect(nil) <- crash

-------
var _transactionContext: PPRetailTransactionContext?
...
_transactionContext?.setCompletedHandler(nil)
PayPalRetailSDK.deviceManager()!.getActiveReader()?.disconnect({ _ in }) <- crash when invoking the completed handler

Please either correct the nullability annotations so that nil can't be passed in, or check if the completion handler is not NULL.

ppmtscory commented 4 years ago

I've filed an internal ticket with the engineering team to have them look into this.