summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-09-29 15:53:41 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-09-29 15:54:05 +0200
commit0aede8eb04cd0873094852580b6c98b5b7722b7c (patch)
tree7eeebe826d8970baf89bda42d9f213122e882d7e
parent3f157eacc6b09081ae99f2979e8bfb895002186f (diff)
spline: fix division by zero
-rw-r--r--spline/spline.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index d6bdf2c1..92e03ade 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -165,7 +165,7 @@ void spline::update_interp_data() const
const QPointF& pt = list[0];
const double x = pt.x();
const double y = pt.y();
- const unsigned max = std::clamp((unsigned)iround(x * c), 0u, value_count-1);
+ const unsigned max = std::clamp((unsigned)iround(x * c), 1u, value_count-1);
for (unsigned k = 0; k <= max; k++)
data[k] = float(y * k / max); // no need for bresenham