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

Commit 945c2497 authored by bohu's avatar bohu
Browse files

bluetooth: fix crash on accessing null adapter

By checking bluetooth adaptor before accessing it,
because it could be null on devices that do not
support bluetooth, such as android emulator.

BUG: 121129248

Test:
lunch sdk_gphone_x86-userdebug
make -j
emulator
launch chrome and it should not crash

Change-Id: Ia75b5ee1efa3a8195056dada079239931eb9d901
parent df20a962
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -67,8 +67,10 @@ public final class BluetoothManager {
        }
        // Legacy api - getDefaultAdapter does not take in the context
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        if (mAdapter != null) {
            mAdapter.setContext(context);
        }
    }

    /**
     * Get the default BLUETOOTH Adapter for this device.