Only add when we know it

This commit is contained in:
Andrew Tomaka 2021-02-21 14:26:38 -05:00
parent 9ad678a541
commit c2df6ac982
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -55,9 +55,6 @@ function GetUnitFromGuid(guid)
end end
function events:INSPECT_READY(guid) function events:INSPECT_READY(guid)
local itemLevel = C_PaperDollInfo.GetInspectItemLevel(GetUnitFromGuid(guid))
print(itemLevel)
if not inspectInitialized then if not inspectInitialized then
print("initializing") print("initializing")
InspectFontStrings["itemLevel"] = InspectFrame:CreateFontString(nil, "OVERLAY") InspectFontStrings["itemLevel"] = InspectFrame:CreateFontString(nil, "OVERLAY")
@ -68,8 +65,12 @@ function events:INSPECT_READY(guid)
inspectInitialized = true inspectInitialized = true
end 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 end
function events:GOSSIP_SHOW() function events:GOSSIP_SHOW()