Skip to content
Snippets Groups Projects
Commit 2763ecd5 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "LeScanner: null check of BluetoothGatt" into main

parents ccc73004 b84b35e5
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment