Skip to content

Commit 8d6575a

Browse files
authored
fix(matter): switch/case scope
1 parent a980226 commit 8d6575a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libraries/Matter/src/Matter.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ static esp_err_t app_attribute_update_cb(
2929
uint32_t attribute_id, esp_matter_attr_val_t *val, void *priv_data)
3030
{
3131
esp_err_t err = ESP_OK;
32+
MatterEndPoint *ep = (MatterEndPoint *) priv_data; // endpoint pointer to base class
33+
if (ep == NULL) {
34+
return err;
35+
}
3236
switch(type) {
3337
case PRE_UPDATE: // Callback before updating the value in the database
3438
log_i("Attribute update callback: PRE_UPDATE");
35-
MatterEndPoint *ep = (MatterEndPoint *) priv_data; // endpoint pointer to base class
36-
if (ep != NULL) {
37-
err = ep->attributeChangeCB(endpoint_id, cluster_id, attribute_id, val) ? ESP_OK : ESP_FAIL;
38-
}
39+
err = ep->attributeChangeCB(endpoint_id, cluster_id, attribute_id, val) ? ESP_OK : ESP_FAIL;
3940
break;
4041
case POST_UPDATE: // Callback after updating the value in the database
4142
log_i("Attribute update callback: POST_UPDATE");
@@ -163,4 +164,4 @@ void ArduinoMatter::decommission() {
163164
// Global Matter Object
164165
ArduinoMatter Matter;
165166

166-
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */
167+
#endif /* CONFIG_ESP_MATTER_ENABLE_DATA_MODEL */

0 commit comments

Comments
 (0)