Made amount_t::price return an optional<amount_t>

This commit is contained in:
John Wiegley 2012-03-07 10:32:35 -06:00
parent b1107f85ae
commit ec1f15a4b2
2 changed files with 3 additions and 3 deletions

View file

@ -787,7 +787,7 @@ amount_t::value(const optional<datetime_t>& moment,
return none;
}
amount_t amount_t::price() const
optional<amount_t> amount_t::price() const
{
if (has_annotation() && annotation().price) {
amount_t tmp(*annotation().price);
@ -795,7 +795,7 @@ amount_t amount_t::price() const
DEBUG("amount.price", "Returning price of " << *this << " = " << tmp);
return tmp;
}
return *this;
return none;
}

View file

@ -407,7 +407,7 @@ public:
value(const optional<datetime_t>& moment = none,
const optional<commodity_t&>& in_terms_of = none) const;
amount_t price() const;
optional<amount_t> price() const;
/*@}*/