diff --git a/src/skeletontomesh.cpp b/src/skeletontomesh.cpp index b4ea76b3..886effab 100644 --- a/src/skeletontomesh.cpp +++ b/src/skeletontomesh.cpp @@ -30,6 +30,7 @@ #include #include #include +#include typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef CGAL::Surface_mesh CgalMesh; @@ -297,6 +298,9 @@ void SkeletonToMesh::process() if (meshIds.size() > 0) { #if USE_EXTERNAL +# if USE_CGAL + CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); +# endif std::vector externalMeshs; for (size_t i = 0; i < meshIds.size(); i++) { int triangledMeshId = meshlite_triangulate(meshliteContext, meshIds[i]); @@ -308,7 +312,12 @@ void SkeletonToMesh::process() for (size_t i = 1; i < externalMeshs.size(); i++) { if (!mergedExternalMesh) break; - ExternalMesh *unionedExternalMesh = unionExternalMeshs(mergedExternalMesh, externalMeshs[i]); + ExternalMesh *unionedExternalMesh = NULL; + try { + unionedExternalMesh = unionExternalMeshs(mergedExternalMesh, externalMeshs[i]); + } catch (...) { + // ignore; + } delete mergedExternalMesh; delete externalMeshs[i]; mergedExternalMesh = unionedExternalMesh;