summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/amount.cc4
-rw-r--r--src/amount.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 313f8d27..c80ca14e 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -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;
}
diff --git a/src/amount.h b/src/amount.h
index 1db59b7e..09256b5d 100644
--- a/src/amount.h
+++ b/src/amount.h
@@ -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;
/*@}*/