mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 22:04:47 +00:00
check for out of bounds when setting unit sides
fixes segfault
This commit is contained in:
parent
d43e6c6d24
commit
ddf22901d7
@ -984,7 +984,7 @@ static int impl_unit_set(lua_State *L)
|
||||
unit &u = *pu;
|
||||
|
||||
// Find the corresponding attribute.
|
||||
modify_int_attrib("side", u.set_side(value));
|
||||
modify_int_attrib_check_range("side", u.set_side(value), 1, static_cast<int>(resources::teams->size()));
|
||||
modify_int_attrib("moves", u.set_movement(value));
|
||||
modify_int_attrib("hitpoints", u.set_hitpoints(value));
|
||||
modify_int_attrib("experience", u.set_experience(value));
|
||||
|
Loading…
x
Reference in New Issue
Block a user