mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix autobug - if gatt is closed while we are shutting down it is not an error
This commit is contained in:
parent
bd29a93a71
commit
a5678392f5
2 changed files with 8 additions and 4 deletions
|
|
@ -409,9 +409,12 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
|||
}
|
||||
}
|
||||
} catch (ex: BLEException) {
|
||||
scheduleReconnect(
|
||||
"Unexpected error discovering services, forcing disconnect $ex"
|
||||
)
|
||||
if (s.gatt == null)
|
||||
warn("GATT was closed while discovering, assume we are shutting down")
|
||||
else
|
||||
scheduleReconnect(
|
||||
"Unexpected error discovering services, forcing disconnect $ex"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -613,7 +613,8 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
|
|||
|
||||
private fun queueDiscoverServices(cont: Continuation<Unit>, timeout: Long = 0) {
|
||||
queueWork("discover", cont, timeout) {
|
||||
gatt?.discoverServices() ?: throw BLEException("GATT is null")
|
||||
gatt?.discoverServices()
|
||||
?: false // throw BLEException("GATT is null") - if we return false here it is probably because the device is being torn down
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue