From c2df6ac9820c11a7194a108d7acd6dfa1b3e5583 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sun, 21 Feb 2021 14:26:38 -0500 Subject: [PATCH] Only add when we know it --- MyAddon.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index a7ac4cb..eef31fc 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -55,9 +55,6 @@ function GetUnitFromGuid(guid) end function events:INSPECT_READY(guid) - local itemLevel = C_PaperDollInfo.GetInspectItemLevel(GetUnitFromGuid(guid)) - print(itemLevel) - if not inspectInitialized then print("initializing") InspectFontStrings["itemLevel"] = InspectFrame:CreateFontString(nil, "OVERLAY") @@ -68,8 +65,12 @@ function events:INSPECT_READY(guid) inspectInitialized = true end - InspectFontStrings["itemLevel"]:SetText(itemLevel) - print(InspectFontStrings["itemLevel"]:GetText()) + + unit = GetUnitFromGuid(guid) + if unit then + local itemLevel = C_PaperDollInfo.GetInspectItemLevel(unit) + InspectFontStrings["itemLevel"]:SetText(itemLevel) + end end function events:GOSSIP_SHOW()