diff options
author | Remco Burema <r.burema@ultimaker.com> | 2022-11-08 18:00:43 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2022-11-08 18:00:43 +0300 |
commit | e9f0b907aa8f9e41ed92d586233580633567264b (patch) | |
tree | 7244d37ecad2894359e2e7a4c4759aaaa4ace2b0 | |
parent | 2d38392d50babc3cf586403dd0977e5aaf85ad64 (diff) |
Terminate (more) loops: Original index could be beyond list-size.
belatedly part of CURA-9486
-rw-r--r-- | include/PathOrderOptimizer.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/PathOrderOptimizer.h b/include/PathOrderOptimizer.h index f571d0fa1..ba659d0f5 100644 --- a/include/PathOrderOptimizer.h +++ b/include/PathOrderOptimizer.h @@ -522,9 +522,9 @@ protected: constexpr coord_t min_edge_length = 10; constexpr coord_t min_edge_length2 = min_edge_length * min_edge_length; - Point here = (*path.converted)[i % path.converted->size()]; + const int offset_index = i % path.converted->size(); + Point here = (*path.converted)[offset_index]; - const int offset_index = i; const std::function<Point(const int, const Point&)> find_neighbour_point = [&offset_index, &path](const int direction, const Point& here) { int offset_index_ = offset_index; |