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

pull/8/head
geeksville 2020-03-06 20:55:47 -08:00
rodzic bb3acc1d0b
commit 9f7ab46bbe
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -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
}
}