summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahix <rahix@rahix.de>2020-05-12 20:29:00 +0200
committerJohn Wiegley <johnw@newartisans.com>2020-07-21 14:50:01 -0700
commit1e3ec9b81008d0b87524db567017d60e24f6601c (patch)
tree02c8792ea96814b718224c1a43583b7abde7c25a
parent220f137ff69c7fcde430a09e86470636910330ef (diff)
downloadfork-ledger-1e3ec9b81008d0b87524db567017d60e24f6601c.tar.gz
fork-ledger-1e3ec9b81008d0b87524db567017d60e24f6601c.tar.bz2
fork-ledger-1e3ec9b81008d0b87524db567017d60e24f6601c.zip
collapse_posts: Fix segfault when depth is too big
When an account already has less depth than collapse_depth, a segfault was caused by attempting to move up the account parents until parent is NULL. Fix this by exiting early if the depth is already less than collapse_depth.
-rw-r--r--src/filters.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 3e481139..574aac3b 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -475,7 +475,7 @@ value_t& collapse_posts::find_totals(account_t* account)
if (collapse_depth == 0)
return totals[_("<Total>")];
- if (account->depth == collapse_depth)
+ if (account->depth <= collapse_depth)
return totals[account->fullname()];
//else recurse