From 1a70b33b4f8b6f8d4844b1b30dde568ae311d0ac Mon Sep 17 00:00:00 2001 From: Christopher Zimmermann Date: Sun, 29 Aug 2021 21:36:17 +0200 Subject: check that commodity format uses correct symbol closes 1948 --- src/textual.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/textual.cc') diff --git a/src/textual.cc b/src/textual.cc index 3b6ef5f4..bc91ef52 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -1126,13 +1126,16 @@ void instance_t::commodity_value_directive(commodity_t& comm, string expr_str) comm.set_value_expr(expr_t(expr_str)); } -void instance_t::commodity_format_directive(commodity_t&, string format) +void instance_t::commodity_format_directive(commodity_t& comm, string format) { // jww (2012-02-27): A format specified this way should turn off // observational formatting. trim(format); amount_t amt; amt.parse(format); + if (amt.commodity() != comm) + throw_(parse_error, _f("commodity directive symbol %1% and format directive symbol %2% should be the same") % + comm.symbol() % amt.commodity().symbol()); amt.commodity().add_flags(COMMODITY_STYLE_NO_MIGRATE); VERIFY(amt.valid()); } -- cgit v1.2.3