diff options
author | Daniel Burrows <dburrows@debian.org> | 2009-05-26 07:57:53 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2009-05-26 07:57:53 -0700 |
commit | 49907bae9369877ce65f456991b84cf09af4745e (patch) | |
tree | 95fea9016020f5e2a4cde643c0fffdd03c1e28a7 /src/generic/problemresolver/incremental_expression.h | |
parent | 70309b9b1a48d856da03cbc93b08b622f99535a2 (diff) | |
download | aptitude-49907bae9369877ce65f456991b84cf09af4745e.tar.gz |
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.
Diffstat (limited to 'src/generic/problemresolver/incremental_expression.h')
-rw-r--r-- | src/generic/problemresolver/incremental_expression.h | 9 |
1 files changed, 6 insertions, 3 deletions
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<expression<T> > &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<expression<T> > &get_child() const |