buttplug-rs-ffi icon indicating copy to clipboard operation
buttplug-rs-ffi copied to clipboard

WebBluetooth writes panic on failure

Open qdot opened this issue 4 years ago • 1 comments

Someone with a fussy on-board bluetooth radio reported a stack that had a panic in the WebBluetoothDevice write() method.

panicked at 'called `Option::unwrap()` on a `None` value', src\wasm\webbluetooth_device.rs:126:53

This was most likely an honest failure to write, but we shouldn't unwrap Nones there, we should return an error.

qdot avatar Jan 25 '21 02:01 qdot

I've encountered write failures of this exact nature when forcibly removing my computer's bluetooth dongle.

I managed to quell these panics by responding to BluetoothDevice's gattserverdisconnected event as done in chrome's bluetooth samples: https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html

Here's the WIP branch. It probably doesn't solve all panic cases, but it's a start for this type of error: CirrusNeptune/buttplug-rs-ffi@f211160b1775f3ab0d4462c48e6009bb6a93dfaf

CirrusNeptune avatar Feb 10 '21 06:02 CirrusNeptune