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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user