Skip to content

Commit 44bc249

Browse files
committed
Fix AndroidCentral.scan()
1 parent cc50746 commit 44bc249

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Sources/AndroidBluetooth/AndroidCentral.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,16 @@ public final class AndroidCentral: CentralManager {
8888
$0.scan.continuation = continuation
8989
}
9090
let scanCallBack = LowEnergyScanCallback(central: self)
91-
scanner.startScan(scanCallBack)
91+
do {
92+
try scanner.startScan(scanCallBack)
93+
}
94+
catch {
95+
continuation.finish(throwing: error)
96+
await storage.update {
97+
$0.scan.peripherals.removeAll()
98+
$0.scan.continuation = nil
99+
}
100+
}
92101
}
93102
})
94103
}

0 commit comments

Comments
 (0)