zxing-js / browser

ZXing for JS's browser layer with decoding implementations for browser.
MIT License
213 stars 43 forks source link

BUG: Missing await causes an uncaught exception #115

Open ddoice opened 1 year ago

ddoice commented 1 year ago

controls.stop

This line is missing an await when calling switchTorch, so if it fails theres no way to capture the error in a try catch.

https://github.com/zxing-js/browser/blob/9e0ef5e4a661a5989a9b4a97117a20b1fcd4527d/src/readers/BrowserCodeReader.ts#L755

image

Somnium7 commented 7 months ago

I also have this issue with "setPhotoOptions" on Android after calling stop. Problem is not only with missing await, but also that it tries to turn off torch when it was not used at all.