1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Throw exception instead of crash on accessing non-existing setting

This commit is contained in:
Ivan Savenko 2023-12-16 12:48:08 +02:00
parent 9ff00d75dc
commit aadfde27bc

View File

@ -118,11 +118,10 @@ void GameSettings::load(const JsonNode & input)
const JsonNode & GameSettings::getValue(EGameSettings option) const const JsonNode & GameSettings::getValue(EGameSettings option) const
{ {
assert(option < EGameSettings::OPTIONS_COUNT);
auto index = static_cast<size_t>(option); auto index = static_cast<size_t>(option);
assert(!gameSettings[index].isNull()); assert(!gameSettings.at(index).isNull());
return gameSettings[index]; return gameSettings.at(index);
} }
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END