diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index 6bf9372e5f0486..a57da5d6d84dd9 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -455,11 +455,12 @@ PyChipError pychip_WriteClient_WriteGroupAttributes(size_t groupIdSizeT, chip::C void pychip_ReadClient_ShutdownSubscription(ReadClient * apReadClient) { - // If an error occurs, the life cycle of apReadClient has ended. + // If apReadClient is nullptr, it means that its life cycle has ended (such as an error happend), and nothing needs to be done. VerifyOrReturn(apReadClient != nullptr); + // If it is not SubscriptionType, this function should not be executed. + VerifyOrDie(apReadClient->IsSubscriptionType()); Optional subscriptionId = apReadClient->GetSubscriptionId(); - // If it is ReadType, this step will not be executed VerifyOrDie(subscriptionId.HasValue()); FabricIndex fabricIndex = apReadClient->GetFabricIndex();