Skip to content

Commit

Permalink
fix(Cooldown): Avoid a nil error in ChargesInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
Cilraaz committed Jul 24, 2024
1 parent 9361f72 commit 5cf8fc8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions HeroLib/Class/Spell/Cooldown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ end
function Spell:ChargesInfo()
local SpellID = self:ID()
local SpellInfo = GetSpellCharges(SpellID)
-- Non-charged spells now return nil, so let's return default values to avoid a nil error.
if not SpellInfo then
return 1, 1, 0, 0
end

return SpellInfo.currentCharges, SpellInfo.maxCharges, SpellInfo.cooldownStartTime, SpellInfo.cooldownDuration
end
Expand Down

0 comments on commit 5cf8fc8

Please sign in to comment.