diff --git a/src/libslic3r/ExtrusionEntity.cpp b/src/libslic3r/ExtrusionEntity.cpp index 3fc9e8bb5..45e0ae5d3 100644 --- a/src/libslic3r/ExtrusionEntity.cpp +++ b/src/libslic3r/ExtrusionEntity.cpp @@ -322,7 +322,7 @@ void ExtrusionLoopSloped::clip_end(const double distance) { double clip_dist = distance; std::vector &ends_slope = this->ends; - while (clip_dist > 0) { + while (clip_dist > 0 && !ends_slope.empty()) { ExtrusionPathSloped &last_path = ends_slope.back(); double len = last_path.length(); if (len <= clip_dist) { @@ -345,7 +345,7 @@ void ExtrusionLoopSloped::clip_front(const double distance) std::vector &start_slope = this->starts; Polyline front_inward; - while (distance > 0) { + while (distance > 0 && !start_slope.empty()) { ExtrusionPathSloped &first_path = start_slope.front(); double len = first_path.length(); if (len <= clip_dist) { diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index f4829429e..9b6735e90 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -4081,13 +4081,14 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou paths.insert(paths.end(), new_loop.paths.begin(), new_loop.paths.end()); paths.insert(paths.end(), new_loop.ends.begin(), new_loop.ends.end()); } + } else { + paths.clear(); + loop.clip_end(clip_length, &paths); + if (paths.empty()) return ""; } } if (!enable_seam_slope || slope_has_overhang) { - if (enable_seam_slope) - paths.back().clip_end(seam_gap); - for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) { gcode += this->_extrude(*path, description, speed_for_path(*path)); }