Skip bluetooth device iteration if LocalBluetoothManager is null

bug:13653239

Change-Id: I163c47b626825b2f83bb63d9f6900216ce44ae41
This commit is contained in:
Nicholas Sauer
2014-03-26 10:23:11 -07:00
parent bece8e8423
commit cb644cc2e7

View File

@@ -443,6 +443,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
// Add cached paired BT devices // Add cached paired BT devices
LocalBluetoothManager lbtm = LocalBluetoothManager.getInstance(context); LocalBluetoothManager lbtm = LocalBluetoothManager.getInstance(context);
// LocalBluetoothManager.getInstance can return null if the device does not
// support bluetooth (e.g. the emulator).
if (lbtm != null) {
Set<BluetoothDevice> bondedDevices = Set<BluetoothDevice> bondedDevices =
lbtm.getBluetoothAdapter().getBondedDevices(); lbtm.getBluetoothAdapter().getBondedDevices();
@@ -453,7 +456,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
data.enabled = enabled; data.enabled = enabled;
result.add(data); result.add(data);
} }
}
return result; return result;
} }
}; };