capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 172 forks source link

ios fix: move Optional nil check to prevent unwrapping error #170

Closed minvernizzinextbit closed 1 year ago

minvernizzinextbit commented 1 year ago

Hi @thegnuu. First of all, thanks for your work on this super helpful plugin! I really appreciate all the effort you (and other maintainers) put into this. I recently updated the plugin to make it work with XCode 14 and Capacitor 4 and after running my tests I found that the app was crashing after closing the BarcodeScanner instance. After looking into it I realized that a small change in the swift code would solve the issue. I'm not an expert Swift developer so I might have missed something else, but after the fix the plugin seems to work as expected. Any feedback would be really appreciated.

This small fix moves the Optional nil check inside DispatchQueue to prevent an unwrapping error on stopScan() that crashes the app using this plugin.

thegnuu commented 1 year ago

@minvernizzinextbit thank you for your PR! I will do my best to have a look at this today! Hopefully I will find time to check it out :)

thegnuu commented 1 year ago

@minvernizzinextbit I had to copy your changes to the main branch since I am unable to merge non-verified commits, but your changes are released in v3.0.1.

Thank you very much!

minvernizzinextbit commented 1 year ago

Glad I could help! Keep up the amazing work 🚀