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

Commit 73c3e5b1 authored by William Escande's avatar William Escande
Browse files

Add null check on getBluetoothGatt

Bug: 299035367
Test: atest FrameworkBluetoothTests
Change-Id: I5ad860895734a79e6c131e266fabe2649a5c727a
parent 8db9f4f3
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -550,9 +550,12 @@ public final class BluetoothLeAdvertiser {
            return;
        }

        IBluetoothGatt gatt;
        IBluetoothGatt gatt = mBluetoothAdapter.getBluetoothGatt();
        if (gatt == null) {
            Log.e(TAG, "Bluetooth GATT is null");
            return;
        }
        try {
            gatt = mBluetoothAdapter.getBluetoothGatt();
            final SynchronousResultReceiver recv = SynchronousResultReceiver.get();
            gatt.stopAdvertisingSet(wrapped, mAttributionSource, recv);
            recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null);