summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/balance.cc3
-rw-r--r--test/regress/1969.test17
2 files changed, 19 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) {
diff --git a/test/regress/1969.test b/test/regress/1969.test
new file mode 100644
index 00000000..4f5a3918
--- /dev/null
+++ b/test/regress/1969.test
@@ -0,0 +1,17 @@
+
+2020-10-30 * Set up liability
+ Expenses:Test 310.56 EUR
+ Liabilities:Foo -310.56 EUR
+
+2020-10-30 * Pay liability
+ Assets:Bank -416.30 AUD @ 0.746 EUR
+ Liabilities:Foo
+
+2020-10-30 * Put another commodity into the account so the account is always displayed
+ Expenses:Test 10.00 GBP
+ Liabilities:Foo
+
+test bal Liabilities:Foo
+ -10.00 GBP Liabilities:Foo
+end test
+