summaryrefslogtreecommitdiff
path: root/src/csgtermnormalizer.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-01-27 10:12:00 (GMT)
committerMarius Kintel <marius@kintel.net>2012-01-27 10:12:00 (GMT)
commit14e4f3bb4659b2d00a55a9b029dd3c7e1373a9c8 (patch)
tree4c53b1c6cce6b2ed1030d7e01966fad8347e0b03 /src/csgtermnormalizer.cc
parentdb6be808578b42e6184302aa813ae790cd09ec60 (diff)
Fixed bug reported by Pasca Andrei: Normalizations resulting in an empty tree caused a crash
Diffstat (limited to 'src/csgtermnormalizer.cc')
-rw-r--r--src/csgtermnormalizer.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc
index 7a59aa1..b63ae05 100644
--- a/src/csgtermnormalizer.cc
+++ b/src/csgtermnormalizer.cc
@@ -2,12 +2,16 @@
#include "csgterm.h"
#include "printutils.h"
+/*!
+ NB! for e.g. empty intersections, this can normalize a tree to nothing and return NULL.
+*/
shared_ptr<CSGTerm> CSGTermNormalizer::normalize(const shared_ptr<CSGTerm> &root,
size_t limit)
{
shared_ptr<CSGTerm> temp = root;
while (1) {
shared_ptr<CSGTerm> n = normalizePass(temp);
+ if (!n) return n; // If normalized to nothing
if (temp == n) break;
temp = n;
contact: Jan Huwald // Impressum