Fixed rare error when entity data is not a table
This commit is contained in:
1 parent
0ec7af80cf
commit
d14a5e5966
1 file changed
+2
-2
@@ -2114,7 +2114,7 @@ end
|
|||||||
---@param entity Entity
|
---@param entity Entity
|
||||||
---@return any?
|
---@return any?
|
||||||
function EID:getEntityData(entity, str)
|
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]
|
return entity:GetData()[str]
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
@@ -2124,7 +2124,7 @@ end
|
|||||||
---@param str string
|
---@param str string
|
||||||
---@param value any
|
---@param value any
|
||||||
function EID:setEntityData(entity, str, value)
|
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
|
entity:GetData()[str] = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user