From 60acec515e6dff56a5c6d114f5faa2a8c9bd2135 Mon Sep 17 00:00:00 2001 From: OgelGames Date: Thu, 25 Apr 2024 02:45:03 +1000 Subject: [PATCH] fix usage of temporary inventory in set_lists --- src/script/lua_api/l_inventory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script/lua_api/l_inventory.cpp b/src/script/lua_api/l_inventory.cpp index 422a080f94..3a189fee7d 100644 --- a/src/script/lua_api/l_inventory.cpp +++ b/src/script/lua_api/l_inventory.cpp @@ -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; }