fix possible crash bug

felipesanches-svg
don bright 2012-10-29 11:46:40 +01:00
parent f54797cfbd
commit 73d8d3cca4
1 changed files with 7 additions and 6 deletions

View File

@ -176,10 +176,16 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
} }
catch (const CGAL::Failure_exception &e) { catch (const CGAL::Failure_exception &e) {
PRINTB("CGAL error in projection node during bigbox intersection: %s", e.what()); 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 // remove z coordinates to make CGAL_Nef_polyhedron2
log << OpenSCAD::svg_header( 480, 100000 ) << "\n"; log << OpenSCAD::svg_header( 480, 100000 ) << "\n";
try { try {
@ -206,11 +212,6 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node)
CGAL::set_error_behaviour(old_behaviour); 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 // Extract polygons in the XY plane, ignoring all other polygons
// FIXME: If the polyhedron is really thin, there might be unwanted 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 // in the XY plane, causing the resulting 2D polygon to be self-intersection