diff options
author | Daniel Burrows <dburrows@debian.org> | 2009-05-26 07:58:58 -0700 |
---|---|---|
committer | Daniel Burrows <dburrows@debian.org> | 2009-05-26 07:58:58 -0700 |
commit | 965157a89f291092aa2251c7168bac0cb5d872bb (patch) | |
tree | b1273b6bd67be92ca63580ff16e07ef2938da759 /src/generic/problemresolver/incremental_expression.h | |
parent | 180841c4db0e46e79a0fee786732df7b5400accf (diff) | |
download | aptitude-965157a89f291092aa2251c7168bac0cb5d872bb.tar.gz |
Also be careful about NULL pointers in get_value().
Diffstat (limited to 'src/generic/problemresolver/incremental_expression.h')
-rw-r--r-- | src/generic/problemresolver/incremental_expression.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/generic/problemresolver/incremental_expression.h b/src/generic/problemresolver/incremental_expression.h index a8ea0c3c..6391c4c1 100644 --- a/src/generic/problemresolver/incremental_expression.h +++ b/src/generic/problemresolver/incremental_expression.h @@ -302,8 +302,16 @@ public: return child; } - /** \brief Returns the child's value. */ - T get_value() { return child->get_value(); } + /** \brief Returns the child's value, or a default-constructed T if + * there is no child. + */ + T get_value() + { + if(child.valid()) + return child->get_value(); + else + return T(); + } }; /** \brief Base class for N-ary containers that support adding and |