diff options
-rw-r--r-- | src/CGAL_Nef_polyhedron.cc | 12 | ||||
-rw-r--r-- | testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/CGAL_Nef_polyhedron.cc b/src/CGAL_Nef_polyhedron.cc index 975c9a4..ccfde24 100644 --- a/src/CGAL_Nef_polyhedron.cc +++ b/src/CGAL_Nef_polyhedron.cc @@ -25,8 +25,16 @@ CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator*=(const CGAL_Nef_polyhedron & CGAL_Nef_polyhedron& CGAL_Nef_polyhedron::operator-=(const CGAL_Nef_polyhedron &other) { - if (this->dim == 2) (*this->p2) -= (*other.p2); - else if (this->dim == 3) (*this->p3) -= (*other.p3); + // Triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad + CGAL::Failure_behaviour old_behaviour = CGAL::set_error_behaviour(CGAL::THROW_EXCEPTION); + try { + if (this->dim == 2) (*this->p2) -= (*other.p2); + else if (this->dim == 3) (*this->p3) -= (*other.p3); + } + catch (CGAL::Assertion_exception e) { + PRINTF("CGAL error in CGAL_Nef_polyhedron::operator-=(): %s", e.what()); + } + CGAL::set_error_behaviour(old_behaviour); return *this; } diff --git a/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad new file mode 100644 index 0000000..d7011d9 --- /dev/null +++ b/testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad @@ -0,0 +1,4 @@ +difference() { + rotate_extrude($fn=5) translate([4,0,0]) square([10, 10], center=true); + translate([6,6,6]) sphere(r=10); +} |