diff options
Diffstat (limited to 'src/session.cc')
-rw-r--r-- | src/session.cc | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/session.cc b/src/session.cc index d53faf09..1477139c 100644 --- a/src/session.cc +++ b/src/session.cc @@ -103,22 +103,13 @@ journal_t * session_t::read_data(const string& master_account) DEBUG("ledger.cache", "using_cache " << cache_file->string()); cache_dirty = true; if (exists(*cache_file)) { - ifstream stream(*cache_file); - - optional<path> price_db_orig = journal->price_db; - try { - journal->price_db = price_db; - - entry_count += read_journal(stream, journal, NULL, data_file); - if (entry_count > 0) - cache_dirty = false; + scoped_variable<optional<path> > + save_price_db(journal->price_db, price_db); - journal->price_db = price_db_orig; - } - catch (...) { - journal->price_db = price_db_orig; - throw; - } + ifstream stream(*cache_file); + entry_count += read_journal(stream, journal, NULL, data_file); + if (entry_count > 0) + cache_dirty = false; } } |