mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix another autobug - clear gatt first, because close() can fail
This commit is contained in:
parent
17faecc170
commit
e6fd79f477
1 changed files with 4 additions and 3 deletions
|
|
@ -676,10 +676,11 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD
|
|||
msecsLeft -= 100
|
||||
}
|
||||
|
||||
if (gatt != null) {
|
||||
gatt?.let { g2 ->
|
||||
warn("Android onConnectionStateChange did not run, manually closing")
|
||||
gatt?.close()
|
||||
gatt = null
|
||||
gatt =
|
||||
null // clear gat before calling close, bcause close might throw dead object exception
|
||||
g2.close()
|
||||
}
|
||||
} catch (ex: DeadObjectException) {
|
||||
warn("Ignoring dead object exception, probably bluetooth was just disabled")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue