summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/textual.cc b/textual.cc
index 57cb0089..e95d0eff 100644
--- a/textual.cc
+++ b/textual.cc
@@ -152,7 +152,7 @@ bool finalize_entry(entry_t * entry)
value_t balance;
- bool first = true;
+ bool no_amounts = true;
for (transactions_list::const_iterator x = entry->transactions.begin();
x != entry->transactions.end();
x++)
@@ -160,15 +160,19 @@ bool finalize_entry(entry_t * entry)
((*x)->flags & TRANSACTION_BALANCE)) {
amount_t * p = (*x)->cost ? (*x)->cost : &(*x)->amount;
if (*p) {
- if (first) {
+ if (no_amounts) {
balance = *p;
- first = false;
+ no_amounts = false;
} else {
balance += *p;
}
}
}
+ // If it's a null entry, then let the user have their fun
+ if (no_amounts)
+ return true;
+
// If one transaction of a two-line transaction is of a different
// commodity than the others, and it has no per-unit price,
// determine its price by dividing the unit count into the value of