using GetSpellInfo with just a spell id is dangerous

Handful of addons will polyfill their own GetSpellInfo that only accept (bookSlot, bookType) so it's only safe to use C_Spell.GetSpellInfo with just a spell id
This commit is contained in:
Brues
2026-07-11 09:47:46 -05:00
parent fb5230828c
commit 7389c241a4
3 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -1020,7 +1020,8 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
local kind, id = GetActionInfo(slot)
local effect, rank
if kind == "spell" then
effect, rank = GetSpellInfo(id)
local spellInfo = C_Spell.GetSpellInfo(id)
effect, rank = spellInfo.name, spellInfo.rank
elseif kind == "macro" then
effect, rank = GetMacroSpell(id)
end
+4 -3
View File
@@ -228,8 +228,8 @@ pfUI.libdebuff_spell_go_hooks["libtotem"] = function(spellId)
-- use pending name/icon if available (set by CastSpellByName hook), else GetSpellInfo
local name = active[slot].pending_name
local icon = active[slot].pending_icon
if not name and GetSpellInfo then
name = GetSpellInfo(spellId)
if not name then
name = C_Spell.GetSpellName(spellId)
end
active[slot].name = name
active[slot].duration = data.duration
@@ -265,7 +265,8 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
local name, rank, spellID
if kind == "spell" then
spellID = id
name, rank = GetSpellInfo(id)
local spellInfo = C_Spell.GetSpellInfo(id)
name, rank = spellInfo.name, spellInfo.rank
elseif kind == "macro" then
name, rank, spellID = GetMacroSpell(id)
end
+1 -1
View File
@@ -430,7 +430,7 @@ pfUI:RegisterModule("swingtimer", function ()
local kind, id = GetActionInfo(slot)
local name
if kind == "spell" then
name = GetSpellInfo(id)
name = C_Spell.GetSpellName(id)
elseif kind == "macro" then
name = GetMacroSpell(id)
end