Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cb581f3

Browse files
authoredMar 28, 2025··
fix(zigbee): test basic_cluster value for null to avoid crash
1 parent 4211b57 commit cb581f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎libraries/Zigbee/src/ZigbeeEP.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ bool ZigbeeEP::setManufacturerAndModel(const char *name, const char *model) {
5555

5656
// Get the basic cluster and update the manufacturer and model attributes
5757
esp_zb_attribute_list_t *basic_cluster = esp_zb_cluster_list_get_cluster(_cluster_list, ESP_ZB_ZCL_CLUSTER_ID_BASIC, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
58+
if (basic_cluster == nullptr) {
59+
log_e("Failed to get basic cluster");
60+
return false;
61+
}
5862
esp_err_t ret_name = esp_zb_basic_cluster_add_attr(basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, (void *)zb_name);
5963
if (ret_name != ESP_OK) {
6064
log_e("Failed to set manufacturer: 0x%x: %s", ret_name, esp_err_to_name(ret_name));

0 commit comments

Comments
 (0)
Please sign in to comment.