From 1b5e18b8e6a2ceea073d3f6b99ff3cbc9d0deb5d Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 28 Mar 2023 20:46:12 -0400 Subject: [PATCH] Make implementing handleBDXTransferSessionEndForNodeID actually optional. (#25871) It's marked @optional in the API, but we're calling it unconditionally. --- .../Framework/CHIP/MTROTAProviderDelegateBridge.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index d85222411918fe..3caacafae59533 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -316,11 +316,13 @@ CHIP_ERROR OnTransferSessionEnd(TransferSession::OutputEvent & event) auto nodeId = @(mNodeId.Value()); auto strongDelegate = mDelegate; - dispatch_async(mDelegateNotificationQueue, ^{ - [strongDelegate handleBDXTransferSessionEndForNodeID:nodeId - controller:controller - error:[MTRError errorForCHIPErrorCode:error]]; - }); + if ([strongDelegate respondsToSelector:@selector(handleBDXTransferSessionEndForNodeID:controller:error:)]) { + dispatch_async(mDelegateNotificationQueue, ^{ + [strongDelegate handleBDXTransferSessionEndForNodeID:nodeId + controller:controller + error:[MTRError errorForCHIPErrorCode:error]]; + }); + } ResetState(); return CHIP_NO_ERROR;