mirror of
https://github.com/esphome/esphome.git
synced 2026-09-24 21:44:04 +00:00
[sensor] Assert size before writing, not after
This commit is contained in:
@@ -346,11 +346,11 @@ uint32_t get_loop_component_start_time();
|
||||
template<size_t N> class ValueListFilter : public Filter {
|
||||
protected:
|
||||
explicit ValueListFilter(std::initializer_list<TemplatableValue<float>> values) {
|
||||
ESPHOME_DEBUG_ASSERT(values.size() == N);
|
||||
size_t i = 0;
|
||||
for (const auto &v : values) {
|
||||
this->values_[i++] = v;
|
||||
}
|
||||
ESPHOME_DEBUG_ASSERT(i == N);
|
||||
}
|
||||
|
||||
/// Check if sensor value matches any configured value (with accuracy rounding)
|
||||
|
||||
Reference in New Issue
Block a user