Skip to content

Commit

Permalink
Address review comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Apr 20, 2023
1 parent 1f825de commit d00c514
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/darwin/Framework/CHIP/MTRBaseDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1324,11 +1324,9 @@ - (void)subscribeToAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullabl
completion:^(ExchangeManager * _Nullable exchangeManager, const Optional<SessionHandle> & session,
NSError * _Nullable error) {
if (error != nil) {
if (reportHandler) {
dispatch_async(queue, ^{
reportHandler(nil, error);
});
}
dispatch_async(queue, ^{
reportHandler(nil, error);
});
return;
}

Expand Down Expand Up @@ -1377,11 +1375,9 @@ - (void)subscribeToAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullabl
nil);
});
} else {
if (reportHandler) {
dispatch_async(queue, ^{
reportHandler(nil, [MTRError errorForCHIPErrorCode:error]);
});
}
dispatch_async(queue, ^{
reportHandler(nil, [MTRError errorForCHIPErrorCode:error]);
});
}
};

Expand Down Expand Up @@ -1463,11 +1459,9 @@ - (void)subscribeToAttributePaths:(NSArray<MTRAttributeRequestPath *> * _Nullabl
}

if (err != CHIP_NO_ERROR) {
if (reportHandler) {
dispatch_async(queue, ^{
reportHandler(nil, [MTRError errorForCHIPErrorCode:err]);
});
}
dispatch_async(queue, ^{
reportHandler(nil, [MTRError errorForCHIPErrorCode:err]);
});
Platform::Delete(readClient);
if (container.pathParams != nullptr) {
Platform::MemoryFree(container.pathParams);
Expand Down

0 comments on commit d00c514

Please sign in to comment.