diff --git a/src/app/clusters/bindings/BindingManager.cpp b/src/app/clusters/bindings/BindingManager.cpp index ad13376a0dfe42..97a08ac5ab52d2 100644 --- a/src/app/clusters/bindings/BindingManager.cpp +++ b/src/app/clusters/bindings/BindingManager.cpp @@ -169,7 +169,7 @@ void BindingManager::FabricRemoved(FabricIndex fabricIndex) CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, ClusterId cluster, void * context) { VerifyOrReturnError(mInitParams.mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mBoundDeviceChangedHandler, CHIP_NO_ERROR); + VerifyOrReturnError(mBoundDeviceChangedHandler != nullptr, CHIP_ERROR_HANDLER_NOT_SET); CHIP_ERROR error = CHIP_NO_ERROR; auto * bindingContext = mPendingNotificationMap.NewPendingNotificationContext(context); diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index 1dc00abcbcf0c8..2e35a3c9628e1b 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -731,6 +731,9 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err) case CHIP_ERROR_MISSING_URI_SEPARATOR.AsInteger(): desc = "The URI separator is missing"; break; + case CHIP_ERROR_HANDLER_NOT_SET.AsInteger(): + desc = "Callback function or callable object is not set"; + break; } #endif // !CHIP_CONFIG_SHORT_ERROR_STR diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 5a170519126f2f..0483c4d76abaed 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -2427,6 +2427,14 @@ using CHIP_ERROR = ::chip::ChipError; */ #define CHIP_ERROR_MISSING_URI_SEPARATOR CHIP_CORE_ERROR(0xe0) +/** + * @def CHIP_ERROR_HANDLER_NOT_SET + * + * @brief + * Callback function or callable object is not set + */ +#define CHIP_ERROR_HANDLER_NOT_SET CHIP_CORE_ERROR(0xe1) + // clang-format on // !!!!! IMPORTANT !!!!! If you add new CHIP errors, please update the translation diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index 1ea3c8834897e5..901dbf4e404a73 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -266,6 +266,7 @@ static const CHIP_ERROR kTestElements[] = CHIP_ERROR_BUSY, CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_REPORT_IB, CHIP_ERROR_IM_MALFORMED_EVENT_STATUS_IB, + CHIP_ERROR_HANDLER_NOT_SET, }; // clang-format on