Workaround to fix crash reported in #2209
This commit is contained in:
parent
4418a9b926
commit
61a0ab4280
@ -108,6 +108,9 @@ stl_fix_normal_directions(stl_file *stl) {
|
|||||||
|
|
||||||
if (stl->error) return;
|
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. */
|
/* Initialize linked list. */
|
||||||
head = (struct stl_normal*)malloc(sizeof(struct stl_normal));
|
head = (struct stl_normal*)malloc(sizeof(struct stl_normal));
|
||||||
if(head == NULL) perror("stl_fix_normal_directions");
|
if(head == NULL) perror("stl_fix_normal_directions");
|
||||||
|
@ -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());
|
Transform3d trafo_instance = Geometry::assemble_transform(Vec3d::Zero(), rotation, finst->get_scaling_factor(), finst->get_mirror());
|
||||||
Polygon p = objptr->convex_hull_2d(trafo_instance);
|
Polygon p = objptr->convex_hull_2d(trafo_instance);
|
||||||
assert(! p.points.empty());
|
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());
|
p.append(p.first_point());
|
||||||
clpath = Slic3rMultiPoint_to_ClipperPath(p);
|
clpath = Slic3rMultiPoint_to_ClipperPath(p);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user