diff options
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 |