summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/accel-lookup.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/accel-lookup.hpp b/common/accel-lookup.hpp
index 4314bfa..968eb6a 100644
--- a/common/accel-lookup.hpp
+++ b/common/accel-lookup.hpp
@@ -254,9 +254,9 @@ namespace rawaccel {
first_log_lookup_speed = exp(start*1.0);
int end = static_cast<int>(floor(log(last_point_speed)));
last_log_lookup_speed = exp(end*1.0);
- int num = static_cast<int>(capacity / (end - start));
+ int num = end > start ? static_cast<int>(capacity / (end - start)) : 1;
range = fp_rep_range{ start, end, num };
- last_log_lookup_index = num * (end - start) - 1;
+ last_log_lookup_index = end > start ? num * (end - start) - 1 : 0;
vec2<float> current = {0, 0};
vec2<float> next;