mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-14 21:26:56 +00:00
Return null instead of crashing when accessing an invalid element of a WFL list
Fixes #5355
This commit is contained in:
parent
b9dcc32e24
commit
891421bb41
@ -189,7 +189,7 @@ variant variant::operator[](std::size_t n) const
|
||||
must_be(VARIANT_TYPE::TYPE_LIST);
|
||||
|
||||
try {
|
||||
return value_cast<variant_list>()->get_container()[n];
|
||||
return value_cast<variant_list>()->get_container().at(n);
|
||||
} catch(std::out_of_range&) {
|
||||
throw type_error("invalid index");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user