diff --git a/src/libslic3r/ShortestPath.cpp b/src/libslic3r/ShortestPath.cpp index 56b1234c1..058802229 100644 --- a/src/libslic3r/ShortestPath.cpp +++ b/src/libslic3r/ShortestPath.cpp @@ -1030,6 +1030,9 @@ void reorder_extrusion_entities(std::vector &entities, const s void chain_and_reorder_extrusion_entities(std::vector &entities, const Point *start_near) { + // this function crashes if there are empty elements in entities + entities.erase(std::remove_if(entities.begin(), entities.end(), [](ExtrusionEntity *entity) { return static_cast(entity)->empty(); }), + entities.end()); reorder_extrusion_entities(entities, chain_extrusion_entities(entities, start_near)); } diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 65f379a9f..d4e4c9899 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -1616,9 +1616,6 @@ void TreeSupport::generate_toolpaths() // sort extrusions to reduce travel, also make sure walls go before infills if (ts_layer->support_fills.no_sort == false) { - // chain_and_reorder_extrusion_entities crashes if there are empty elements in entities - auto &entities = ts_layer->support_fills.entities; - entities.erase(std::remove_if(entities.begin(), entities.end(), [](ExtrusionEntity* entity) { return static_cast(entity)->empty(); }), entities.end()); chain_and_reorder_extrusion_entities(ts_layer->support_fills.entities); } }