summaryrefslogtreecommitdiff
path: root/format.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-21 15:55:03 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-21 15:55:03 -0400
commit000bfe1cece3ecbfee8f07a46d1f0b000dbbc983 (patch)
tree6d2c666097900fff421da6a57b41f0a7c43a39b7 /format.cc
parent225acd14e57a0a476ce022a7c5703a8f1cee34ef (diff)
downloadfork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.tar.gz
fork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.tar.bz2
fork-ledger-000bfe1cece3ecbfee8f07a46d1f0b000dbbc983.zip
only compute the cost when it differs from the amount
Diffstat (limited to 'format.cc')
-rw-r--r--format.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/format.cc b/format.cc
index 6d9f9384..44307d05 100644
--- a/format.cc
+++ b/format.cc
@@ -289,8 +289,8 @@ void format_t::format_elements(std::ostream& out,
std::string disp;
bool use_disp = false;
- if (details.xact->amount != details.xact->cost) {
- amount_t unit_cost = details.xact->cost / details.xact->amount;
+ if (details.xact->cost) {
+ amount_t unit_cost = *details.xact->cost / details.xact->amount;
std::ostringstream stream;
stream << details.xact->amount << " @ " << unit_cost;
disp = stream.str();