From e99382da680da615b7fd1886ed8e1252d1a4be9c Mon Sep 17 00:00:00 2001 From: Rodrigo Faselli <162915171+RF47@users.noreply.github.com> Date: Wed, 22 Apr 2026 13:21:19 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5Fix=20crash=20svg=20use=20surface?= =?UTF-8?q?=20(#13262)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix crash svg use surface * unnecesarry header --- src/libslic3r/CutSurface.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libslic3r/CutSurface.cpp b/src/libslic3r/CutSurface.cpp index 01a5a8383a..606a5b8aaa 100644 --- a/src/libslic3r/CutSurface.cpp +++ b/src/libslic3r/CutSurface.cpp @@ -2559,6 +2559,21 @@ void priv::create_face_types(FaceTypeMap &map, bool priv::clip_cut(SurfacePatch &cut, CutMesh clipper) { CutMesh& tm = cut.mesh; + auto is_mesh_usable_for_clip = [](const CutMesh &mesh) { + return !mesh.is_empty() && + mesh.number_of_vertices() >= 3 && + mesh.number_of_faces() > 0 && + mesh.is_valid(false); + }; + + if (!is_mesh_usable_for_clip(tm) || !is_mesh_usable_for_clip(clipper)) + return false; + + // Hard-stop pathological inputs before entering corefinement internals. + if (CGAL::Polygon_mesh_processing::does_self_intersect(tm) || + CGAL::Polygon_mesh_processing::does_self_intersect(clipper)) + return false; + // create backup for case that there is no intersection CutMesh backup_copy = tm;