Skip to content

Commit

Permalink
fix(server): check if data is a table before accessing it (#1655)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frowmza authored Mar 15, 2024
1 parent e15f44b commit 1106bac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ local function openInventory(source, invType, data, ignoreSecurityChecks)
end

if data then
local isDataTable = type(data) == 'table'
if invType == 'stash' then
right = Inventory(data, left)
if right == false then return false end
elseif type(data) == 'table' then
elseif isDataTable then
if data.netid then
data.type = invType
right = Inventory(data)
Expand Down Expand Up @@ -164,7 +165,7 @@ local function openInventory(source, invType, data, ignoreSecurityChecks)
}

if invType == 'container' then hookPayload.slot = left.containerSlot end
if data.netid then hookPayload.netId = data.netid end
if isDataTable and data.netid then hookPayload.netId = data.netid end

if not TriggerEventHooks('openInventory', hookPayload) then return end

Expand Down

0 comments on commit 1106bac

Please sign in to comment.