Skip to content

Commit

Permalink
fix crash when seam placement (fix fbaf8d5)
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Sep 16, 2022
1 parent 0b1923f commit b1bce7b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/libslic3r/GCode/SeamPlacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,16 +1167,17 @@ std::optional<Point> SeamHistory::get_last_seam(const PrintObject* po, double la
void SeamHistory::add_seam(const PrintObject* po, const Point& pos, double layer_z, const BoundingBox& island_bb)
{
std::map<const PrintObject*, std::vector<SeamPoint>>* data_this_layer = nullptr;
for (auto it = m_data.begin(); it != m_data.end(); ++it) {
for (std::vector<std::pair<double, std::map<const PrintObject*, std::vector<SeamPoint>>>>::iterator it = m_data.begin(); it != m_data.end(); ++it) {
if (it->first == layer_z) {
data_this_layer = &it->second;
break;
}
if (it->first >= layer_z) {
//add it before
m_data.emplace(it);
it->first = layer_z;
data_this_layer = &it->second;
auto it_new = m_data.emplace(it);
it_new->first = layer_z;
data_this_layer = &it_new->second;
break;
}
}
if (data_this_layer == nullptr) {
Expand Down

0 comments on commit b1bce7b

Please sign in to comment.