diff --git a/src/admesh/normals.cpp b/src/admesh/normals.cpp index a8faa44bd..0ad134360 100644 --- a/src/admesh/normals.cpp +++ b/src/admesh/normals.cpp @@ -108,6 +108,9 @@ stl_fix_normal_directions(stl_file *stl) { if (stl->error) return; + // this may happen for malformed models, see: https://github.com/prusa3d/Slic3r/issues/2209 + if (stl->stats.number_of_facets == 0) return; + /* Initialize linked list. */ head = (struct stl_normal*)malloc(sizeof(struct stl_normal)); if(head == NULL) perror("stl_fix_normal_directions"); diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index 50901da3a..c821eef77 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -567,8 +567,13 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) { Transform3d trafo_instance = Geometry::assemble_transform(Vec3d::Zero(), rotation, finst->get_scaling_factor(), finst->get_mirror()); Polygon p = objptr->convex_hull_2d(trafo_instance); assert(! p.points.empty()); - p.reverse(); - assert(! p.is_counter_clockwise()); + + // this may happen for malformed models, see: https://github.com/prusa3d/Slic3r/issues/2209 + if (p.points.empty()) + continue; + + p.reverse(); + assert(!p.is_counter_clockwise()); p.append(p.first_point()); clpath = Slic3rMultiPoint_to_ClipperPath(p); }