summaryrefslogtreecommitdiff
path: root/src/PolySetCGALEvaluator.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-10-29 10:46:40 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-10-29 10:46:40 (GMT)
commit73d8d3cca4de55e81d47732f2b1f9507cc0d23b4 (patch)
treec735eb90f2125a87556b65060ef4606d635e9163 /src/PolySetCGALEvaluator.cc
parentf54797cfbda8b7e667fd5294bbca3b885d1b18de (diff)
fix possible crash bug
Diffstat (limited to 'src/PolySetCGALEvaluator.cc')
-rw-r--r--src/PolySetCGALEvaluator.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc
index 6ff1e35..8e08e19 100644
--- a/src/PolySetCGALEvaluator.cc
+++ b/src/PolySetCGALEvaluator.cc
@@ -176,10 +176,16 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
}
catch (const CGAL::Failure_exception &e) {
PRINTB("CGAL error in projection node during bigbox intersection: %s", e.what());
- sum.p3.reset( new CGAL_Nef_polyhedron3() );
+ sum.p3->clear();
}
}
+ if ( sum.p3->is_empty() ) {
+ CGAL::set_error_behaviour(old_behaviour);
+ PRINT("WARNING: projection() failed.");
+ return NULL;
+ }
+
// remove z coordinates to make CGAL_Nef_polyhedron2
log << OpenSCAD::svg_header( 480, 100000 ) << "\n";
try {
@@ -206,11 +212,6 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
CGAL::set_error_behaviour(old_behaviour);
- if ( sum.p3->is_empty() ) {
- PRINT("WARNING: projection() failed.");
- return NULL;
- }
-
// Extract polygons in the XY plane, ignoring all other polygons
// FIXME: If the polyhedron is really thin, there might be unwanted polygons
// in the XY plane, causing the resulting 2D polygon to be self-intersection
contact: Jan Huwald // Impressum