From 3c7e2519baf477682c9c0e98c3d07463498ad7af Mon Sep 17 00:00:00 2001 From: ANTOND <71350868+antond15@users.noreply.github.com> Date: Wed, 21 Feb 2024 05:05:44 +0100 Subject: [PATCH] fix(server/inventory): support for item name in GetItemSlots (#1591) --- modules/inventory/server.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/inventory/server.lua b/modules/inventory/server.lua index 79a14b0373..d027948c34 100644 --- a/modules/inventory/server.lua +++ b/modules/inventory/server.lua @@ -1223,8 +1223,10 @@ exports('Search', Inventory.Search) ---@param item table | string ---@param metadata? table function Inventory.GetItemSlots(inv, item, metadata) - inv = Inventory(inv) --[[@as OxInventory]] + if type(item) ~= 'table' then item = Items(item) end + if not item then return end + inv = Inventory(inv) --[[@as OxInventory]] if not inv?.slots then return end local totalCount, slots, emptySlots = 0, {}, inv.slots