Skip to content

Commit 4c3f0ea

Browse files
committed
Properly convert peripheral UUID for isConnected on iOS (#1033)
1 parent b5518ca commit 4c3f0ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ios/BLECentralPlugin.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,13 @@ - (void)stopScan:(CDVInvokedUrlCommand*)command {
430430

431431

432432
- (void)isConnected:(CDVInvokedUrlCommand*)command {
433+
NSUUID *uuid = [self getUUID:command argumentAtIndex:0];
434+
if (uuid == nil) {
435+
return;
436+
}
437+
438+
CBPeripheral *peripheral = [self findPeripheralByUUID:uuid];
433439
CDVPluginResult *pluginResult = nil;
434-
CBPeripheral *peripheral = [self findPeripheralByUUID:[command argumentAtIndex:0]];
435-
436440
if (peripheral && peripheral.state == CBPeripheralStateConnected) {
437441
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
438442
} else {

0 commit comments

Comments
 (0)