Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84dbf462 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing crash in emulator due to no BluetoothAdapter. (Bug 7188166)

Change-Id: I63fe4b229a8a460170df153e71b7ad65655dfad1
parent 24ed2769
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -96,16 +96,18 @@ public class BluetoothController extends BroadcastReceiver {
    }

    private void updateBondedBluetoothDevices() {
        Set<BluetoothDevice> devices = BluetoothAdapter.getDefaultAdapter().getBondedDevices();
        if (devices != null) {
        mBondedDevices.clear();

        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
        if (adapter != null) {
            Set<BluetoothDevice> devices = adapter.getBondedDevices();
            if (devices != null) {
                for (BluetoothDevice device : devices) {
                    if (device.getBondState() != BluetoothDevice.BOND_NONE) {
                        mBondedDevices.add(device);
                    }
                }
        } else {
            mBondedDevices.clear();
            }
        }
    }