Clear the settings store if parsing the loaded JSON file fails

This commit is contained in:
Adam Honse 2020-11-04 19:54:39 -06:00
parent 5b68efd09f
commit b8835ad44f

View file

@ -43,7 +43,19 @@ void SettingsManager::LoadSettings(std::string filename)
| Read settings into JSON store |
\*---------------------------------------------------------*/
if(settings_file)
{
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();
}
}
}