From e1ac8839b621c5f558566fab50866cfc61f8051d Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Mon, 19 Apr 2010 06:41:59 -0700 Subject: Hopefully fix a crashing bug in the resolver. (Closes: #578344) When I built a new validity expression as a result of combining promotions, I forgot that expressions can be NULL and that NULL is implicitly treated as a universally true expression. It might be more robust to fully incorporate that into the API of the expressions module at some point. --- src/generic/problemresolver/promotion_set.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/generic/problemresolver') diff --git a/src/generic/problemresolver/promotion_set.h b/src/generic/problemresolver/promotion_set.h index 2beb67d1..c37cdb1d 100644 --- a/src/generic/problemresolver/promotion_set.h +++ b/src/generic/problemresolver/promotion_set.h @@ -151,8 +151,16 @@ public: // Note that this will compute a somewhat inefficient validity // condition when applied across several expressions. - cwidget::util::ref_ptr > new_valid = - and_e::create(p1_valid, p2_valid); + cwidget::util::ref_ptr > new_valid; + if(p1_valid.valid()) + { + if(p2_valid.valid()) + new_valid = and_e::create(p1_valid, p2_valid); + else + new_valid = p1_valid; + } + else + new_valid = p2_valid; return generic_promotion(new_choices, new_cost, new_valid); } -- cgit v1.2.3