Fixed rare error when entity data is not a table

This commit is contained in:
Wofsauge committed 2025-05-07 18:46:05 +02:00
1 parent 0ec7af80cf
commit d14a5e5966
1 file changed
+2 -2
+2 -2
View File
@@ -2114,7 +2114,7 @@ end
---@param entity Entity
---@return any?
function EID:getEntityData(entity, str)
if EID:EntitySanityCheck(entity) and not EID:IsGridEntity(entity) and entity:GetData() ~= nil then
if EID:EntitySanityCheck(entity) and not EID:IsGridEntity(entity) and entity:GetData() ~= nil and type(entity:GetData()) == "table" then
return entity:GetData()[str]
end
return nil
@@ -2124,7 +2124,7 @@ end
---@param str string
---@param value any
function EID:setEntityData(entity, str, value)
if EID:EntitySanityCheck(entity) and not EID:IsGridEntity(entity) and entity:GetData() ~= nil then
if EID:EntitySanityCheck(entity) and not EID:IsGridEntity(entity) and entity:GetData() ~= nil and type(entity:GetData()) == "table" then
entity:GetData()[str] = value
end
end