Skip to content

Commit

Permalink
fix(client/api): check netId/entityId before creating table
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Nov 8, 2022
1 parent 3660ca9 commit dba88eb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ function target.addEntity(arr, options)
for i = 1, #arr do
local netId = arr[i]

if not Entities[netId] then
Entities[netId] = {}
end

if NetworkDoesNetworkIdExist(netId) then
if not Entities[netId] then
Entities[netId] = {}
end

addTarget(Entities[netId], options, resource)
end
end
Expand Down Expand Up @@ -200,11 +200,11 @@ function target.addLocalEntity(arr, options)
for i = 1, #arr do
local entity = arr[i]

if not LocalEntities[entity] then
LocalEntities[entity] = {}
end

if DoesEntityExist(entity) then
if not LocalEntities[entity] then
LocalEntities[entity] = {}
end

addTarget(LocalEntities[entity], options, resource)
else
print(("No entity with id '%s' exists."):format(entity))
Expand Down

0 comments on commit dba88eb

Please sign in to comment.