fix crashlytics report: if user turns off bluetooth, disabling scan might fail

This commit is contained in:
geeksville
2020-03-06 20:55:47 -08:00
parent bb3acc1d0b
commit 9f7ab46bbe

View File

@@ -45,7 +45,11 @@ object ScanState : Logging {
fun stopScan() {
if (callback != null) {
debug("stopping scan")
scanner!!.stopScan(callback)
try {
scanner!!.stopScan(callback)
} catch (ex: IllegalStateException) {
warn("Ignoring error stopping scan, user probably disabled bluetooth: $ex")
}
callback = null
}
}