This commit is contained in:
Ryzerth
2021-08-04 00:14:55 +02:00
parent 604a559b54
commit 2a6c742a51
8 changed files with 39 additions and 13 deletions

View File

@ -32,9 +32,16 @@ void ConfigManager::load(json def, bool lock) {
return;
}
std::ifstream file(path.c_str());
file >> conf;
file.close();
try {
std::ifstream file(path.c_str());
file >> conf;
file.close();
}
catch (std::exception e) {
spdlog::error("Config file '{0}' is corrupted, resetting it", path);
conf = def;
save(false);
}
if (lock) { mtx.unlock(); }
}