From b1a04923fefdc83387b776b6684188ce2175bfc4 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 16 Mar 2006 11:58:44 +0000 Subject: *** empty log message *** --- textual.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'textual.cc') diff --git a/textual.cc b/textual.cc index 29b548e5..4e2a12f4 100644 --- a/textual.cc +++ b/textual.cc @@ -229,16 +229,19 @@ transaction_t * parse_transaction(char * line, account_t * account, else per_unit_cost /= xact->amount; - if (! xact->amount.commodity().annotated) { - xact->amount.annotate_commodity(per_unit_cost, - xact->entry->actual_date(), - xact->entry->code); - } else { - annotated_commodity_t& ann(static_cast - (xact->amount.commodity())); - xact->amount.annotate_commodity(! ann.price ? per_unit_cost : amount_t(), - ! ann.date ? xact->entry->actual_date() : 0, - ann.tag.empty() ? xact->entry->code : ""); + if (xact->amount.commodity()) { + if (! xact->amount.commodity().annotated) { + xact->amount.annotate_commodity(per_unit_cost, + xact->entry->actual_date(), + xact->entry->code); + } else { + annotated_commodity_t& ann(static_cast + (xact->amount.commodity())); + xact->amount.annotate_commodity + (! ann.price ? per_unit_cost : amount_t(), + ! ann.date ? xact->entry->actual_date() : 0, + ann.tag.empty() ? xact->entry->code : ""); + } } DEBUG_PRINT("ledger.textual.parse", "line " << linenum << ": " << -- cgit v1.2.3