forked from organicmaps/organicmaps
Added try/catch when adding mwm files to model to avoid continuous crashes on startup with wrong data
This commit is contained in:
parent
bcf371cfc2
commit
bd3d2b328a
1 changed files with 9 additions and 1 deletions
|
@ -55,7 +55,15 @@ namespace storage
|
|||
string const dataPath = p.WritableDir();
|
||||
p.GetFilesInDir(dataPath, "*" DATA_FILE_EXTENSION, filesList);
|
||||
for (Platform::FilesList::iterator it = filesList.begin(); it != filesList.end(); ++it)
|
||||
m_addMap(dataPath + *it);
|
||||
{ // simple way to avoid continuous crashes with invalid data files
|
||||
try {
|
||||
m_addMap(dataPath + *it);
|
||||
} catch (std::exception const & e)
|
||||
{
|
||||
FileWriter::DeleteFileX(dataPath + *it);
|
||||
LOG(LWARNING, (e.what(), "while adding file", *it, "so this file is deleted"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string Storage::UpdateBaseUrl() const
|
||||
|
|
Loading…
Add table
Reference in a new issue