Fix unchecked lua_tostring calls

develop
lethosor 2023-09-06 18:19:31 -04:00
parent 47666e12cd
commit 337260ab0c
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 3 additions and 3 deletions

@ -1368,8 +1368,8 @@ static CommandHistory * ensureCommandHistory(std::string id,
static int getCommandHistory(lua_State *state)
{
std::string id = lua_tostring(state, 1);
std::string src_file = lua_tostring(state, 2);
std::string id = luaL_checkstring(state, 1);
std::string src_file = luaL_checkstring(state, 2);
std::vector<std::string> entries;
ensureCommandHistory(id, src_file)->getEntries(entries);
Lua::PushVector(state, entries);
@ -2030,7 +2030,7 @@ static int units_getCitizens(lua_State *L) {
}
static int units_getUnitsByNobleRole(lua_State *L) {
std::string role_name = lua_tostring(L, -1);
std::string role_name = luaL_checkstring(L, -1);
std::vector<df::unit *> units;
Units::getUnitsByNobleRole(units, role_name);
Lua::PushVector(L, units);