1
0
mirror of https://github.com/luanti-org/luanti.git synced 2026-01-13 20:55:30 +01:00

fix usage of temporary inventory in set_lists

This commit is contained in:
OgelGames
2024-04-25 02:45:03 +10:00
parent be540043ee
commit 60acec515e

View File

@@ -264,8 +264,8 @@ int InvRef::l_set_lists(lua_State *L)
}
// Make a temporary inventory in case reading fails
Inventory *tempInv(inv);
tempInv->clear();
Inventory tempInv(*inv);
tempInv.clear();
Server *server = getServer(L);
@@ -273,10 +273,10 @@ int InvRef::l_set_lists(lua_State *L)
luaL_checktype(L, 2, LUA_TTABLE);
while (lua_next(L, 2)) {
const char *listname = lua_tostring(L, -2);
read_inventory_list(L, -1, tempInv, listname, server);
read_inventory_list(L, -1, &tempInv, listname, server);
lua_pop(L, 1);
}
inv = tempInv;
*inv = tempInv;
return 0;
}