From 2c2731598aac00589be3f525687e0b3d272ed7eb Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Wed, 4 Apr 2012 01:46:50 +0200 Subject: Missing NULL check on some normalization corner cases. Fixes #95 diff --git a/src/csgtermnormalizer.cc b/src/csgtermnormalizer.cc index 0e7a759..b4bfa4c 100644 --- a/src/csgtermnormalizer.cc +++ b/src/csgtermnormalizer.cc @@ -44,9 +44,10 @@ shared_ptr CSGTermNormalizer::normalizePass(shared_ptr 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? -- cgit v0.10.1