Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Commit 1106bac

Browse files
authored
fix(server): check if data is a table before accessing it (#1655)
1 parent e15f44b commit 1106bac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

server.lua

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ local function openInventory(source, invType, data, ignoreSecurityChecks)
112112
end
113113

114114
if data then
115+
local isDataTable = type(data) == 'table'
115116
if invType == 'stash' then
116117
right = Inventory(data, left)
117118
if right == false then return false end
118-
elseif type(data) == 'table' then
119+
elseif isDataTable then
119120
if data.netid then
120121
data.type = invType
121122
right = Inventory(data)
@@ -164,7 +165,7 @@ local function openInventory(source, invType, data, ignoreSecurityChecks)
164165
}
165166

166167
if invType == 'container' then hookPayload.slot = left.containerSlot end
167-
if data.netid then hookPayload.netId = data.netid end
168+
if isDataTable and data.netid then hookPayload.netId = data.netid end
168169

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

0 commit comments

Comments
 (0)