diff options
author | Nicholas Sauer <nicksauer@google.com> | 2014-03-27 21:37:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-03-27 21:37:19 +0000 |
commit | c33baa4294388a80ea791fc436ee90cd6501caa0 (patch) | |
tree | 4cbdc3ca4102d4745d68ae5ad07549ed570db1e5 | |
parent | c96ccc8585b10b56f34744473a75b8ff5e6115aa (diff) | |
parent | cb644cc2e75a994a3977662626060acf4803bbce (diff) | |
download | packages_apps_Settings-c33baa4294388a80ea791fc436ee90cd6501caa0.zip packages_apps_Settings-c33baa4294388a80ea791fc436ee90cd6501caa0.tar.gz packages_apps_Settings-c33baa4294388a80ea791fc436ee90cd6501caa0.tar.bz2 |
Merge "Skip bluetooth device iteration if LocalBluetoothManager is null"
-rwxr-xr-x | src/com/android/settings/bluetooth/BluetoothSettings.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index cc0371f..1285e7a 100755 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -443,17 +443,20 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem // Add cached paired BT devices LocalBluetoothManager lbtm = LocalBluetoothManager.getInstance(context); - Set<BluetoothDevice> bondedDevices = - lbtm.getBluetoothAdapter().getBondedDevices(); - - for (BluetoothDevice device : bondedDevices) { - data = new SearchIndexableRaw(context); - data.title = device.getName(); - data.screenTitle = res.getString(R.string.bluetooth_settings); - data.enabled = enabled; - result.add(data); + // LocalBluetoothManager.getInstance can return null if the device does not + // support bluetooth (e.g. the emulator). + if (lbtm != null) { + Set<BluetoothDevice> bondedDevices = + lbtm.getBluetoothAdapter().getBondedDevices(); + + for (BluetoothDevice device : bondedDevices) { + data = new SearchIndexableRaw(context); + data.title = device.getName(); + data.screenTitle = res.getString(R.string.bluetooth_settings); + data.enabled = enabled; + result.add(data); + } } - return result; } }; |