Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE on Android when stopping scanning and the Bluetooth adapter has gone #399

Open
blackspherefollower opened this issue Oct 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@blackspherefollower
Copy link
Contributor

Describe the bug
From sentry:

NullPointerException: Attempt to invoke virtual method 'void android.bluetooth.le.BluetoothLeScanner.stopScan(android.bluetooth.le.ScanCallback)' on a null object reference

I suspect that the unchecked results in https://github.com/deviceplug/btleplug/blob/master/src/droidplug/java/src/main/java/com/nonpolynomial/btleplug/android/impl/Adapter.java#L39 are to blame (it's probably safe to ignore NULL results, as that suggests the Bluetooth adapter has gone away and hence the scan has already stopped).

Whilst I can't reproduce this, the reporter stated that they had Bluetooth disabled on their phone when they experienced the crash (Android 10 running on an LG K50S)

@blackspherefollower blackspherefollower added the bug Something isn't working label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant