diff options
author | John Wiegley <johnw@newartisans.com> | 2005-07-28 23:54:56 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 02:41:17 -0400 |
commit | ed63481f3b1ff66f4ec2ef34f237002e33c0825c (patch) | |
tree | 00298aa86ad5395913b6736b3c55cb2b4d8a90a0 /binary.cc | |
parent | d65a758c8428403ece6548955a206a4b18a577b2 (diff) | |
download | ledger-ed63481f3b1ff66f4ec2ef34f237002e33c0825c.tar.gz ledger-ed63481f3b1ff66f4ec2ef34f237002e33c0825c.tar.bz2 ledger-ed63481f3b1ff66f4ec2ef34f237002e33c0825c.zip |
*** empty log message ***
Diffstat (limited to 'binary.cc')
-rw-r--r-- | binary.cc | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -11,7 +11,7 @@ namespace ledger { static unsigned long binary_magic_number = 0xFFEED765; -static unsigned long format_version = 0x00020039; +static unsigned long format_version = 0x00020040; static account_t ** accounts; static account_t ** accounts_next; @@ -421,10 +421,14 @@ unsigned int read_binary_journal(std::istream& in, commodities = commodities_next = new commodity_t *[c_count]; for (commodity_t::ident_t i = 0; i < c_count; i++) { commodity_t * commodity = read_binary_commodity(data); - std::pair<commodities_map::iterator, bool> result - = commodity_t::commodities.insert(commodities_pair(commodity->symbol, - commodity)); - assert(result.second); + if (! (commodity->flags & COMMODITY_STYLE_BUILTIN)) { + std::pair<commodities_map::iterator, bool> result + = commodity_t::commodities.insert(commodities_pair(commodity->symbol, + commodity)); + if (! result.second) + throw error(std::string("Failed to read commodity from cache: ") + + commodity->symbol); + } } for (commodity_t::ident_t i = 0; i < c_count; i++) |