MovingAverage: nelems of zero is not allowed

This commit is contained in:
2026-04-15 11:17:19 +02:00
parent 06c4b8fdf2
commit 694c250b3e
+7 -1
View File
@@ -4,7 +4,13 @@
#include <cmath>
#include "MovingAverage.h"
MovingAverage::MovingAverage(size_t elems) : elems(elems) {}
#include "JFJochException.h"
MovingAverage::MovingAverage(size_t elems) : elems(elems) {
if (elems == 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Moving average size must be positive");
}
void MovingAverage::Add(float val) {
std::unique_lock ul(m);