Early exit in GameTooltipHooks code fails when the addon database isn't fully initialized
Beet4 opened this issue · 2 comments
I get the following LUA Errors on 10.0.2 pre-patch, I have r718-release-2 installed.
34x ...nterface/AddOns/Rarity/Core/GUI/GameTooltipHooks.lua:31: attempt to index field 'db' (a nil value)
[string "@Interface/AddOns/Rarity/Core/GUI/GameTooltipHooks.lua"]:31: in function <...nterface/AddOns/Rarity/Core/GUI/GameTooltipHooks.lua:27>
[string "=(tail call)"]: ?
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:60: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:55>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:80: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:76>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:116: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:106>
[string "=[C]"]: in function `SetAttribute'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:141: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:134>
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:282: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:240>
[string "=[C]"]: in function `securecallfunction'
[string "@Interface/SharedXML/Tooltip/TooltipDataHandler.lua"]:237: in function <Interface/SharedXML/Tooltip/TooltipDataHandler.lua:236>
[string "=(tail call)"]: ?
[string "@Interface/AddOns/HandyNotes_Shadowlands/core/util.lua"]:30: in function `Prepare'
[string "@Interface/AddOns/HandyNotes_Shadowlands/core/util.lua"]:67: in function `PrepareLinks'
[string "@Interface/AddOns/HandyNotes_Shadowlands/core/groups.lua"]:25: in function `Initialize'
[string "@Interface/AddOns/HandyNotes_Shadowlands/core/class.lua"]:56: in function `Group'
[string "@Interface/AddOns/HandyNotes_Shadowlands/common.lua"]:216: in main chunk
Locals:
tooltip = HandyNotes_Shadowlands_NamePreparer {
0 = <userdata>
SetQuestLogRewardSpell = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetQuestPartyProgress = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
ProcessLineData = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:303
SetPvpTalent = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetRuneforgeResultItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetHyperlink = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetUnit = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetAzeriteEssence = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetVoidDepositItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetVoidWithdrawalItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetInfoBackdropStyle = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:338
SetSocketGem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
info = <table> {
}
updateTooltipTimer = 0.200000
SetLootCurrency = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetSlottedKeystone = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetWorldCursor = <function> defined @Interface/FrameXML/GameTooltip.lua:952
SetLootItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
StatusBar = HandyNotes_Shadowlands_NamePreparerStatusBar {
}
GetUnit = <function> defined @Interface/FrameXML/GameTooltip.lua:994
SetOwnedItemByID = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetMerchantCostItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetQuestLogSpecialItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetItemInteractionItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
TextRight1 = HandyNotes_Shadowlands_NamePreparerTextRight1 {
}
SetRecipeReagentItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetQuestCurrency = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetEnhancedConduit = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetWeeklyReward = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetMerchantItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetPvpBrawl = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetAchievementByID = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
BottomOverlay = Texture {
}
SetSpellByID = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
supportsDataRefresh = true
SetSocketedRelic = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
ProcessInfo = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:236
ProcessLines = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:293
NineSlice = Frame {
}
SetInventoryItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
RefreshData = <function> defined @Interface/FrameXML/GameTooltip.lua:933
SetTransmogrifyItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetLootRollItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
OnLoad = <function> defined @Interface/FrameXML/GameTooltip.lua:927
SetQuestLogCurrency = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetUnitDebuffByAuraInstanceID = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
SetBagItem = <function> defined @Interface/SharedXML/Tooltip/TooltipDataHandler.lua:444
GetSpell = <function> defined @Interface
Until they fix it, simply change the order of the two if statements in Rarity/Core/GUI/GameTooltipHooks.lua, lines 31–37, so that it looks like this:
if not R.db or R.db.profile.enableTooltipAdditions == false then
return
end
-- If debug mode is on, find NPCID from mouseover target and append it to the tooltip
if R.db.profile.debugMode then
GameTooltip:AddLine("NPCID: " .. R:GetNPCIDFromGUID(UnitGUID("mouseover")), 255, 255, 255)
end
Until they fix it, simply change the order of the two if statements in Rarity/Core/GUI/GameTooltipHooks.lua, lines 31–37, so that it looks like this:
if not R.db or R.db.profile.enableTooltipAdditions == false then return end -- If debug mode is on, find NPCID from mouseover target and append it to the tooltip if R.db.profile.debugMode then GameTooltip:AddLine("NPCID: " .. R:GetNPCIDFromGUID(UnitGUID("mouseover")), 255, 255, 255) end
Yeah, no idea what happened there. The early exit obviously won't work if the database isn't yet initialized.
I'll fix it with the next release.