summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Michlmayr <tbm@cyrius.com>2020-10-30 15:57:05 +0800
committerJohn Wiegley <johnw@newartisans.com>2020-10-30 10:08:50 -0700
commitf6c5b04fee4884edc36c36a0b57d3f73f79c86e6 (patch)
tree4b58a5299bab0139f012ad1bdc7a56d31bb90038 /src
parentf4b16ef2d1860b294f6f93123e0ebc7c9c16e9f2 (diff)
downloadfork-ledger-f6c5b04fee4884edc36c36a0b57d3f73f79c86e6.tar.gz
fork-ledger-f6c5b04fee4884edc36c36a0b57d3f73f79c86e6.tar.bz2
fork-ledger-f6c5b04fee4884edc36c36a0b57d3f73f79c86e6.zip
Fix regression in sorted_amounts
Commit 557ab32 ("Expose a new utility function for balances: sorted_amounts") split out some code into a separate function. Unfortunately, in the process an "if" statement was dropped, leading to amounts being shown that shouldn't be shown because they are smaller than the display precision. Fixes #1969
Diffstat (limited to 'src')
-rw-r--r--src/balance.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/balance.cc b/src/balance.cc
index 0a2a3fec..5d8785db 100644
--- a/src/balance.cc
+++ b/src/balance.cc
@@ -273,7 +273,8 @@ balance_t::strip_annotations(const keep_details_t& what_to_keep) const
void balance_t::sorted_amounts(amounts_array& sorted) const
{
foreach (const amounts_map::value_type& pair, amounts)
- sorted.push_back(&pair.second);
+ if (pair.second)
+ sorted.push_back(&pair.second);
std::stable_sort(
sorted.begin(), sorted.end(),
[](const amount_t * left, const amount_t * right) {