[sensor] Assert size before writing, not after

This commit is contained in:
J. Nick Koston
2026-03-27 15:49:57 -10:00
parent c8609af6ce
commit 70a9c2f8b6
+1 -1
View File
@@ -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)