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

Commit 625bc4bd authored by bohu's avatar bohu
Browse files

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
parent df1cbdcf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -496,8 +496,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem

        @Override
        public void setListening(boolean listening) {
            if (listening) {
            BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
            if (defaultAdapter == null) return;
            if (listening) {
                mEnabled = defaultAdapter.isEnabled();
                mConnected =
                        defaultAdapter.getConnectionState() == BluetoothAdapter.STATE_CONNECTED;