Clear the settings store if parsing the loaded JSON file fails
This commit is contained in:
parent
5b68efd09f
commit
b8835ad44f
1 changed files with 13 additions and 1 deletions
|
|
@ -44,6 +44,18 @@ void SettingsManager::LoadSettings(std::string filename)
|
|||
\*---------------------------------------------------------*/
|
||||
if(settings_file)
|
||||
{
|
||||
settings_file >> settings_data;
|
||||
try
|
||||
{
|
||||
settings_file >> settings_data;
|
||||
}
|
||||
catch(std::exception e)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| If an exception was caught, that means the JSON |
|
||||
| parsing failed. Clear out any data in the store |
|
||||
| as it is corrupt. |
|
||||
\*-------------------------------------------------*/
|
||||
settings_data.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue