Skip to content

Commit 1ccdfe1

Browse files
committed
Fix manuData bug
1 parent 75fc506 commit 1ccdfe1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

OpenTrace/Bluetrace/CentralController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ extension CentralController: CBCentralManagerDelegate {
163163

164164
// iphones will "mask" the peripheral's identifier for android devices, resulting in the same android device being discovered multiple times with different peripheral identifier. Hence android is using CBAdvertisementDataServiceDataKey data for identifying an android pheripheral
165165
if let manuData = advertisementData[CBAdvertisementDataManufacturerDataKey] as? Data {
166+
guard manuData.count > 2 else {
167+
return
168+
}
166169
let androidIdentifierData = manuData.subdata(in: 2..<manuData.count)
167170
if discoveredAndroidPeriManufacturerToUUIDMap.keys.contains(androidIdentifierData) {
168171
Logger.DLog("Android Peripheral \(peripheral) has been discovered already in this window, will not attempt to connect to it again")

0 commit comments

Comments
 (0)