From 49907bae9369877ce65f456991b84cf09af4745e Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Tue, 26 May 2009 07:57:53 -0700 Subject: Be more careful about NULL pointers. I really meant to write this code in the last commit, but the cat distracted me by jumping on the keyboard and I forgot to do it. --- src/generic/problemresolver/incremental_expression.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/generic/problemresolver/incremental_expression.h') diff --git a/src/generic/problemresolver/incremental_expression.h b/src/generic/problemresolver/incremental_expression.h index 4b6b73c1..7c8fa9c5 100644 --- a/src/generic/problemresolver/incremental_expression.h +++ b/src/generic/problemresolver/incremental_expression.h @@ -276,14 +276,17 @@ public: ~expression_box() { - child->remove_parent(this); + if(child.valid()) + child->remove_parent(this); } void set_child(const cwidget::util::ref_ptr > &new_child) { - child->remove_parent(this); + if(child.valid()) + child->remove_parent(this); child = new_child; - new_child->add_parent(this); + if(new_child.valid()) + new_child->add_parent(this); } const cwidget::util::ref_ptr > &get_child() const -- cgit v1.2.3