Emulator: avoid accessing null BluetoothAdapter
bug: 27324609 Emulator has no bluetooth support at this moment, and settings should not crash in this case. Change-Id: I1bfc6c907ac02d4798b6c118291e6a9d1bf23c7c
This commit is contained in:
@@ -496,8 +496,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
|
||||
|
||||
@Override
|
||||
public void setListening(boolean listening) {
|
||||
BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (defaultAdapter == null) return;
|
||||
if (listening) {
|
||||
BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mEnabled = defaultAdapter.isEnabled();
|
||||
mConnected =
|
||||
defaultAdapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED;
|
||||
|
Reference in New Issue
Block a user