Skip to content

Commit eaea9ad

Browse files
Device name can be null in some circumstances (#61)
We didn't reproduce this but based on this crash and similar guards elsewhere in the code this seems a reasonable fix. https://play.google.com/console/u/0/developers/4695663865375895527/app/4975736116501095047/vitals/crashes/e9abff6694fe9443f6d3423bb5f7b44b/details?days=28&versionCode=57&isUserPerceived=true
1 parent 013c3e6 commit eaea9ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/java/com/samsung/microbit/utils/BLEPair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ public void onReceive(Context context, Intent intent) {
643643
final int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.ERROR);
644644
final int prevState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE, BluetoothDevice.ERROR);
645645
logi("pairReceiver -" + " name = " + name + " addr = " + addr + " state = " + state + " prevState = " + prevState);
646-
if (name.isEmpty() || addr.isEmpty()) {
646+
if (name == null || name.isEmpty() || addr.isEmpty()) {
647647
return;
648648
}
649649
// Check the changed device is the one we are trying to pair

0 commit comments

Comments
 (0)