Skip to content

Commit

Permalink
Lua API: Fix crash if passing an out-of-bounds side to wesnoth.interf…
Browse files Browse the repository at this point in the history
…ace.end_turn
  • Loading branch information
CelticMinstrel committed Jul 6, 2021
1 parent 24286db commit 0b80652
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -1671,7 +1671,7 @@ int game_lua_kernel::intf_end_turn(lua_State* L)
//but the later will make the turn counter change aswell fire turn end events accoringly etc.
if (!lua_isnoneornil(L, 1)) {
int npn = luaL_checkinteger(L, 1);
if (npn <= 0 /*TODO: || npn > 2*nteams*/) {
if (npn <= 0 || npn > 2 * teams().size()) {
return luaL_argerror(L, 1, "side number out of range");
}
resources::controller->gamestate().next_player_number_ = npn;
Expand Down

0 comments on commit 0b80652

Please sign in to comment.