Permalink
Browse files

Missing NULL check on some normalization corner cases. Fixes #95

  • Loading branch information...
kintel committed Apr 3, 2012
1 parent 405dfaa commit 2c2731598aac00589be3f525687e0b3d272ed7eb
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/csgtermnormalizer.cc
View
@@ -44,9 +44,10 @@ shared_ptr<CSGTerm> CSGTermNormalizer::normalizePass(shared_ptr<CSGTerm> term)
do {
while (term && normalize_tail(term)) { }
if (!term || term->type == CSGTerm::TYPE_PRIMITIVE) return term;
- term->left = normalizePass(term->left);
+ if (term->left) term->left = normalizePass(term->left);
} while (term->type != CSGTerm::TYPE_UNION &&
- (term->right->type != CSGTerm::TYPE_PRIMITIVE || term->left->type == CSGTerm::TYPE_UNION));
+ (term->right && term->right->type != CSGTerm::TYPE_PRIMITIVE ||
+ term->left && term->left->type == CSGTerm::TYPE_UNION));
term->right = normalizePass(term->right);
// FIXME: Do we need to take into account any transformation of item here?

0 comments on commit 2c27315

Please sign in to comment.