diff options
author | Marius Kintel <marius@kintel.net> | 2012-02-03 02:19:56 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-02-03 02:19:56 (GMT) |
commit | 34a5f89184072d85be8bc9778f06e2c78b379a0d (patch) | |
tree | fe96df45049901cb13d7b59e7cb83fc2dfc0cd5c /src/PolySetCGALEvaluator.cc | |
parent | 1ce1b8824968a55ecd2b9d689b2720594b59d632 (diff) |
Gracefully handle errors converting a Nef polyhedron to a polyset. Fixes #77
Diffstat (limited to 'src/PolySetCGALEvaluator.cc')
-rw-r--r-- | src/PolySetCGALEvaluator.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc index c3f4774..22567f2 100644 --- a/src/PolySetCGALEvaluator.cc +++ b/src/PolySetCGALEvaluator.cc @@ -90,6 +90,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } PolySet *ps3 = sum.convertToPolyset(); + if (!ps3) return NULL; Grid2d<int> conversion_grid(GRID_COARSE); for (size_t i = 0; i < ps3->polygons.size(); i++) { for (size_t j = 0; j < ps3->polygons[i].size(); j++) { @@ -121,6 +122,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const ProjectionNode &node) } PolySet *ps3 = sum.convertToPolyset(); + if (!ps3) return NULL; CGAL_Nef_polyhedron np; for (size_t i = 0; i < ps3->polygons.size(); i++) { @@ -385,7 +387,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const CgaladvNode &node) PolySet *ps = NULL; if (!N.empty()) { ps = N.convertToPolyset(); - ps->convexity = node.convexity; + if (ps) ps->convexity = node.convexity; } return ps; @@ -401,7 +403,7 @@ PolySet *PolySetCGALEvaluator::evaluatePolySet(const RenderNode &node) } else { ps = N.convertToPolyset(); - ps->convexity = node.convexity; + if (ps) ps->convexity = node.convexity; } } return ps; |