From d00c514dbd51b3148dc3ed4b4f531dec3dd0c103 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 20 Apr 2023 01:21:20 -0400 Subject: [PATCH] Address review comment. --- src/darwin/Framework/CHIP/MTRBaseDevice.mm | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index f65102804b0afa..a966a34dde8cf1 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -1324,11 +1324,9 @@ - (void)subscribeToAttributePaths:(NSArray * _Nullabl completion:^(ExchangeManager * _Nullable exchangeManager, const Optional & session, NSError * _Nullable error) { if (error != nil) { - if (reportHandler) { - dispatch_async(queue, ^{ - reportHandler(nil, error); - }); - } + dispatch_async(queue, ^{ + reportHandler(nil, error); + }); return; } @@ -1377,11 +1375,9 @@ - (void)subscribeToAttributePaths:(NSArray * _Nullabl nil); }); } else { - if (reportHandler) { - dispatch_async(queue, ^{ - reportHandler(nil, [MTRError errorForCHIPErrorCode:error]); - }); - } + dispatch_async(queue, ^{ + reportHandler(nil, [MTRError errorForCHIPErrorCode:error]); + }); } }; @@ -1463,11 +1459,9 @@ - (void)subscribeToAttributePaths:(NSArray * _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);