X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FDeviceListActivity.java;h=f36ef267c9c5c2660c5431e72638a388aa85125f;hb=21d176f161b90f18f236ef887cef9676d712eee3;hp=4af117a29bbde343c91a0a0b8c6416aa0836280d;hpb=2509b664df6a13e6ae9e6753dc9fa0d696a4f6c7;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/DeviceListActivity.java b/altosdroid/src/org/altusmetrum/AltosDroid/DeviceListActivity.java index 4af117a2..f36ef267 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/DeviceListActivity.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/DeviceListActivity.java @@ -191,14 +191,22 @@ public class DeviceListActivity extends Activity { // When discovery finds a device if (BluetoothDevice.ACTION_FOUND.equals(action)) { - // Get the BluetoothDevice object from the Intent + + /* Get the BluetoothDevice object from the Intent + */ BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - // If it's already paired, skip it, because it's been listed already - if ( device.getBondState() != BluetoothDevice.BOND_BONDED - && device.getName().startsWith("TeleBT") ) { - mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); + + /* If it's already paired, skip it, because it's been listed already + */ + if (device != null && device.getBondState() != BluetoothDevice.BOND_BONDED) + { + String name = device.getName(); + if (name != null && name.startsWith("TeleBT")) + mNewDevicesArrayAdapter.add(device.getName() + "\n" + device.getAddress()); } - // When discovery is finished, change the Activity title + + /* When discovery is finished, change the Activity title + */ } else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) { setProgressBarIndeterminateVisibility(false); setTitle(R.string.select_device);