diff --git a/app/build.gradle b/app/build.gradle index 92d419653..8b36f7912 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,7 @@ android { minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works) targetSdkVersion 29 versionCode 20102 // format is Mmmss (where M is 1+the numeric major number - versionName "1.1.02" + versionName "1.1.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt index 04e272ebf..611053f98 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/SettingsFragment.kt @@ -6,7 +6,6 @@ import android.app.PendingIntent import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothDevice.BOND_BONDED import android.bluetooth.BluetoothDevice.BOND_BONDING -import android.bluetooth.BluetoothManager import android.bluetooth.le.* import android.companion.AssociationRequest import android.companion.BluetoothDeviceFilter @@ -658,9 +657,13 @@ class SettingsFragment : ScreenFragment("Settings"), Logging { // The device the user is already paired with is offline currently, still show it // it in the list, but greyed out if (!hasShownOurDevice) { - if (scanModel.selectedBluetooth != null && adapter != null && adapter.isEnabled) { + // Note: we pull this into a tempvar, because otherwise some other thread can change selectedAddress after our null check + // and before use + val bleAddr = scanModel.selectedBluetooth + + if (bleAddr != null && adapter != null && adapter.isEnabled) { val bDevice = - adapter.getRemoteDevice(scanModel.selectedBluetooth) + adapter.getRemoteDevice(bleAddr) if (bDevice.name != null) { // ignore nodes that node have a name, that means we've lost them since they appeared val curDevice = BTScanModel.DeviceListEntry( bDevice.name, diff --git a/app/src/main/proto b/app/src/main/proto index b6b1cca5a..5cdd7bff5 160000 --- a/app/src/main/proto +++ b/app/src/main/proto @@ -1 +1 @@ -Subproject commit b6b1cca5ada3bc22c6b84761846e889315160db3 +Subproject commit 5cdd7bff56b0ea54351e5ea0e358e864b061078f