From 1db4cfcb5f59c627783e24088c3c048d24033736 Mon Sep 17 00:00:00 2001 From: P3tray <31691973+P3tray@users.noreply.github.com> Date: Thu, 10 Feb 2022 19:17:58 +0000 Subject: [PATCH] Account for characters without an inventory Account for characters, such as NPC's, who have a character but not an inventory, this causes an index nil error. --- gamemode/core/meta/sh_item.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemode/core/meta/sh_item.lua b/gamemode/core/meta/sh_item.lua index 767b7c44a..278bdbb02 100644 --- a/gamemode/core/meta/sh_item.lua +++ b/gamemode/core/meta/sh_item.lua @@ -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