summaryrefslogtreecommitdiff
path: root/src/commodity.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/commodity.cc')
-rw-r--r--src/commodity.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index e57b5eac..01f14ac9 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -182,7 +182,10 @@ amount_t commodity_t::exchange(const amount_t& amount,
basis_cost = final_cost;
amount_t ann_amount(amount);
- ann_amount.annotate(annotation_t(per_unit_cost, moment->date(), tag));
+ ann_amount.annotate
+ (annotation_t(per_unit_cost,
+ moment ? moment->date() : optional<date_t>(), tag));
+
return ann_amount;
}