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:
parent
9ff00d75dc
commit
aadfde27bc
@ -118,11 +118,10 @@ void GameSettings::load(const JsonNode & input)
|
||||
|
||||
const JsonNode & GameSettings::getValue(EGameSettings option) const
|
||||
{
|
||||
assert(option < EGameSettings::OPTIONS_COUNT);
|
||||
auto index = static_cast<size_t>(option);
|
||||
|
||||
assert(!gameSettings[index].isNull());
|
||||
return gameSettings[index];
|
||||
assert(!gameSettings.at(index).isNull());
|
||||
return gameSettings.at(index);
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
Loading…
Reference in New Issue
Block a user