Skip to content

Commit

Permalink
Account for characters without an inventory
Browse files Browse the repository at this point in the history
Account for characters, such as NPC's, who have a character but not an inventory, this causes an index nil error.
  • Loading branch information
P3tray authored Feb 10, 2022
1 parent e247f44 commit 1db4cfc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gamemode/core/meta/sh_item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function ITEM:GetOwner()
for _, v in ipairs(player.GetAll()) do
local character = v:GetCharacter()

if (character and character:GetInventory():GetItemByID(id)) then
if (character and character:GetInventory() and character:GetInventory():GetItemByID(id)) then
return v
end
end
Expand Down

0 comments on commit 1db4cfc

Please sign in to comment.