FIX: add protection to fix crash when mesh boolean

when the split has no effect
we should return directly

Change-Id: I81510c3edea96e101abfedf77023264e06d7d35c
This commit is contained in:
lane.wei 2023-08-01 20:36:01 +08:00 committed by Lane.Wei
parent 4d2c5ddcde
commit 2dde3708d1
1 changed files with 6 additions and 0 deletions

View File

@ -670,6 +670,12 @@ void do_boolean(McutMesh &srcMesh, const McutMesh &cutMesh, const std::string &b
indexed_triangle_set all_its;
TriangleMesh tri_src = mcut_to_triangle_mesh(srcMesh);
std::vector<indexed_triangle_set> src_parts = its_split(tri_src.its);
if (src_parts.size() == 1)
{
//can not split, return error directly
BOOST_LOG_TRIVIAL(error) << boost::format("bool operation %1% failed, also can not split")%boolean_opts;
return;
}
for (size_t i = 0; i < src_parts.size(); i++)
{
auto part = triangle_mesh_to_mcut(src_parts[i]);