autobug - don't fail if the gatt goes away while we are connecting

pull/71/head
geeksville 2020-06-28 16:09:37 -07:00
rodzic 3246bd6505
commit 68cc494021
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -285,10 +285,11 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
*/
private fun forceServiceRefresh() {
exceptionReporter {
// BluetoothGatt gatt
val gatt = safe!!.gatt!!
val refresh: Method = gatt.javaClass.getMethod("refresh")
refresh.invoke(gatt)
// If the gatt has been destroyed, skip the refresh attempt
safe?.gatt?.let { gatt ->
val refresh: Method = gatt.javaClass.getMethod("refresh")
refresh.invoke(gatt)
}
}
}