diff --git a/components/esp_matter/esp_matter_attribute_utils.h b/components/esp_matter/esp_matter_attribute_utils.h index 188e24246..ce9af58d0 100644 --- a/components/esp_matter/esp_matter_attribute_utils.h +++ b/components/esp_matter/esp_matter_attribute_utils.h @@ -33,7 +33,7 @@ * Example: To convert the temperature mireds into temperature kelvin and vice-versa where the relation between them * is: Mireds = 1,000,000/Kelvin. */ -#define REMAP_TO_RANGE_INVERSE(value, factor) (factor / value) +#define REMAP_TO_RANGE_INVERSE(value, factor) (factor / (value ? value : 1)) /* Nullable base for nullable attribute */ #define ESP_MATTER_VAL_NULLANLE_BASE 0x80