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

Commit b84b35e5 authored by William Escande's avatar William Escande
Browse files

LeScanner: null check of BluetoothGatt

Flag: EXEMPT, null check without flow change
Bug: 315117872
Fix: 315117872
Test: m BluetoothFramework | No test exist for race condition
Change-Id: Ic36b154431e79cc09f19a9a3497c2eeebfa7d051
parent a013cded
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -323,9 +323,12 @@ public final class BluetoothLeScanner {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN)
    public void stopScan(PendingIntent callbackIntent) {
        BluetoothLeUtils.checkAdapterStateOn(mBluetoothAdapter);
        IBluetoothGatt gatt;
        try {
            gatt = mBluetoothAdapter.getBluetoothGatt();
            IBluetoothGatt gatt = mBluetoothAdapter.getBluetoothGatt();
            if (gatt == null) {
                Log.w(TAG, "stopScan called after bluetooth has been turned off");
                return;
            }
            final SynchronousResultReceiver recv = SynchronousResultReceiver.get();
            gatt.stopScanForIntent(callbackIntent, mAttributionSource, recv);
            recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null);