diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index a2a2680f5..3aa99e2b7 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1910,14 +1910,15 @@ static inline void improve_ordering_by_two_exchanges_with_segment_flipping(Polyl for (const FlipEdge &edge : edges) { Polyline &pl = polylines[edge.source_index]; out.emplace_back(std::move(pl)); - if (edge.p2 == pl.first_point().cast()) { + if (edge.p2 == out.back().first_point().cast()) { // Polyline is flipped. out.back().reverse(); } else { // Polyline is not flipped. - assert(edge.p1 == pl.first_point().cast()); + assert(edge.p1 == out.back().first_point().cast()); } } + polylines = out; #ifndef NDEBUG double cost_final = cost();