From 750e1f9f649e0908bf1d89c9e31d61ef0f56fe7f Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Mon, 8 Oct 2012 20:45:47 -0400 Subject: Catch exceptions as const references. Fixes #204 diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 064a36a..5e16892 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -81,15 +81,13 @@ void CGALEvaluator::process(CGAL_Nef_polyhedron &target, const CGAL_Nef_polyhedr break; } } - catch (CGAL::Failure_exception e) { - // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad + catch (const CGAL::Failure_exception &e) { + // union && difference assert triggered by testdata/scad/bugs/rotate-diff-nonmanifold-crash.scad and testdata/scad/bugs/issue204.scad std::string opstr = op == CGE_UNION ? "union" : op == CGE_INTERSECTION ? "intersection" : op == CGE_DIFFERENCE ? "difference" : op == CGE_MINKOWSKI ? "minkowski" : "UNKNOWN"; PRINTB("CGAL error in CGAL_Nef_polyhedron's %s operator: %s", opstr % e.what()); - // Minkowski errors can result in corrupt polyhedrons - if (op == CGE_MINKOWSKI) { - target = src; - } + // Errors can result in corrupt polyhedrons, so put back the old one + target = src; } CGAL::set_error_behaviour(old_behaviour); } @@ -649,7 +647,7 @@ CGAL_Nef_polyhedron CGALEvaluator::evaluateCGALMesh(const PolySet &ps) N = new CGAL_Nef_polyhedron3(*P); } } - catch (CGAL::Assertion_exception e) { + catch (const CGAL::Assertion_exception &e) { PRINTB("CGAL error in CGAL_Nef_polyhedron3(): %s", e.what()); } CGAL::set_error_behaviour(old_behaviour); -- cgit v0.10.1