summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Michael <simon@joyful.com>2013-01-11 10:12:42 -0800
committerSimon Michael <simon@joyful.com>2013-01-11 10:12:42 -0800
commit0790920424befd67db7b986724b70f72b2d9592b (patch)
treec62ba25bacd6af9c859130c8c780da4dc065d969 /src
parentea09a8d50720f0ca42cee46d017e111a4349fa97 (diff)
parentaba0a5ed2dc2dc91f61be32f4c12a5cf6bffd754 (diff)
downloadfork-ledger-0790920424befd67db7b986724b70f72b2d9592b.tar.gz
fork-ledger-0790920424befd67db7b986724b70f72b2d9592b.tar.bz2
fork-ledger-0790920424befd67db7b986724b70f72b2d9592b.zip
Merge branch 'next' of github.com:ledger/ledger into next
Diffstat (limited to 'src')
-rw-r--r--src/filters.cc3
-rw-r--r--src/journal.cc13
2 files changed, 14 insertions, 2 deletions
diff --git a/src/filters.cc b/src/filters.cc
index 5e2bf983..7570809a 100644
--- a/src/filters.cc
+++ b/src/filters.cc
@@ -983,7 +983,8 @@ void interval_posts::flush()
sort_posts_by_date());
// Determine the beginning interval by using the earliest post
- if (! interval.find_period(all_posts.front()->date()))
+ if (all_posts.front() &&
+ ! interval.find_period(all_posts.front()->date()))
throw_(std::logic_error, _("Failed to find period for interval report"));
// Walk the interval forward reporting all posts within each one
diff --git a/src/journal.cc b/src/journal.cc
index e6c09125..f45b7527 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -127,8 +127,19 @@ account_t * journal_t::register_account(const string& name, post_t * post,
// object.
if (account_aliases.size() > 0) {
accounts_map::const_iterator i = account_aliases.find(name);
- if (i != account_aliases.end())
+ if (i != account_aliases.end()) {
result = (*i).second;
+ } else {
+ // only check the very first account for alias expansion, in case
+ // that can be expanded successfully
+ size_t colon = name.find(':');
+ if(colon != string::npos) {
+ accounts_map::const_iterator i = account_aliases.find(name.substr(0, colon));
+ if (i != account_aliases.end()) {
+ result = find_account((*i).second->fullname() + name.substr(colon));
+ }
+ }
+ }
}
// Create the account object and associate it with the journal; this