Skip over invalid entries in the MRU file rather than crashing on startup

Originally committed to SVN as r5670.
This commit is contained in:
Thomas Goyne 2011-09-29 00:37:18 +00:00
parent c328bdfa5f
commit 34a7f16214
1 changed files with 6 additions and 1 deletions

View File

@ -120,7 +120,12 @@ static json::String cast_str(json::UnknownElement const& e) {
/// @param key List name.
/// @param array json::Array of values.
void MRUManager::Load(const std::string &key, const json::Array& array) {
transform(array.Begin(), array.End(), back_inserter(mru[key]), cast_str);
try {
transform(array.Begin(), array.End(), back_inserter(mru[key]), cast_str);
}
catch (json::Exception const&) {
// Out of date MRU file; just discard the data and skip it
}
Prune(mru[key]);
}