diff options
author | Marius Kintel <marius@kintel.net> | 2010-11-07 22:50:57 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2010-11-07 22:50:57 (GMT) |
commit | 93c00f9efe181caf1fc033c6eec986e6abefa814 (patch) | |
tree | 1755ea9b1635045a6333ec86890eaf82ca373c6e /src/CGALRenderer.cc | |
parent | ab90b38780365943877d1f173d6ae0b692b6ce51 (diff) |
Allow render_polyset() to return NULL
Diffstat (limited to 'src/CGALRenderer.cc')
-rw-r--r-- | src/CGALRenderer.cc | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index 9e98b61..4963814 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -231,17 +231,19 @@ Response CGALRenderer::visit(State &state, const AbstractPolyNode &node) // Then apply polyset operation PolySet *ps = node.render_polyset(AbstractPolyNode::RENDER_CGAL, &this->psrenderer); - try { - CGAL_Nef_polyhedron N = renderCGALMesh(*ps); + if (ps) { + try { + CGAL_Nef_polyhedron N = renderCGALMesh(*ps); // print_messages_pop(); - node.progress_report(); - - ps->unlink(); - this->cache.insert(this->tree.getString(node), N); - } - catch (...) { // Don't leak the PolySet on ProgressCancelException - ps->unlink(); - throw; + node.progress_report(); + + ps->unlink(); + this->cache.insert(this->tree.getString(node), N); + } + catch (...) { // Don't leak the PolySet on ProgressCancelException + ps->unlink(); + throw; + } } } addToParent(state, node); @@ -274,18 +276,20 @@ CGAL_Nef_polyhedron CGALRenderer::renderCGALMesh(const AbstractPolyNode &node) // print_messages_push(); PolySet *ps = node.render_polyset(AbstractPolyNode::RENDER_CGAL); - try { - CGAL_Nef_polyhedron N = ps->renderCSGMesh(); - // FIXME: Insert into cache - // print_messages_pop(); - node.progress_report(); - - ps->unlink(); - return N; - } - catch (...) { // Don't leak the PolySet on ProgressCancelException - ps->unlink(); - throw; + if (ps) { + try { + CGAL_Nef_polyhedron N = ps->renderCSGMesh(); + // FIXME: Insert into cache + // print_messages_pop(); + node.progress_report(); + + ps->unlink(); + return N; + } + catch (...) { // Don't leak the PolySet on ProgressCancelException + ps->unlink(); + throw; + } } } #endif |