diff options
author | Rahix <rahix@rahix.de> | 2020-05-12 20:29:00 +0200 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2020-07-21 14:50:01 -0700 |
commit | 1e3ec9b81008d0b87524db567017d60e24f6601c (patch) | |
tree | 02c8792ea96814b718224c1a43583b7abde7c25a | |
parent | 220f137ff69c7fcde430a09e86470636910330ef (diff) | |
download | fork-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.cc | 2 |
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 |