From 5cf8fc82a944030d23cacf1f92acd01d4d6c61b4 Mon Sep 17 00:00:00 2001 From: Cilraaz Date: Wed, 24 Jul 2024 16:31:09 -0400 Subject: [PATCH] fix(Cooldown): Avoid a nil error in ChargesInfo() --- HeroLib/Class/Spell/Cooldown.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/HeroLib/Class/Spell/Cooldown.lua b/HeroLib/Class/Spell/Cooldown.lua index 86d82af3..1b9d9a65 100755 --- a/HeroLib/Class/Spell/Cooldown.lua +++ b/HeroLib/Class/Spell/Cooldown.lua @@ -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