diff --git a/Core.lua b/Core.lua index 5d7db64..f892f30 100644 --- a/Core.lua +++ b/Core.lua @@ -3579,8 +3579,8 @@ function IsCurrentAction(slot) if spellId then -- Prefer GetCastInfo (Nampower 2.18+) for cleaner API if GetCastInfo then - local info = GetCastInfo() - if info and info.spellId == spellId then + local ok, info = pcall(GetCastInfo) + if ok and info and info.spellId == spellId then -- Spell is actively being cast/channeled return true end @@ -4206,8 +4206,8 @@ function CleveRoids.Frame:SPELLCAST_CHANNEL_START() -- Try to get spell info - prefer GetCastInfo (Nampower 2.18+) for better data local spellId = nil if GetCastInfo then - local info = GetCastInfo() - if info and info.spellId and info.spellId > 0 then + local ok, info = pcall(GetCastInfo) + if ok and info and info.spellId and info.spellId > 0 then spellId = info.spellId -- Also capture timing data CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs @@ -4272,8 +4272,8 @@ function CleveRoids.Frame:SPELLCAST_START() -- Try to get spell info - prefer GetCastInfo (Nampower 2.18+) for better data local spellId = nil if GetCastInfo then - local info = GetCastInfo() - if info and info.spellId and info.spellId > 0 then + local ok, info = pcall(GetCastInfo) + if ok and info and info.spellId and info.spellId > 0 then spellId = info.spellId -- Also capture timing data CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs diff --git a/Init.lua b/Init.lua index ad56807..88acb99 100644 --- a/Init.lua +++ b/Init.lua @@ -87,8 +87,8 @@ CleveRoids.UpdateCastingState = function() -- Enhanced timing data from GetCastInfo (Nampower 2.18+) if GetCastInfo then - local info = GetCastInfo() - if info then + local ok, info = pcall(GetCastInfo) + if ok and info then CleveRoids.CurrentSpell.castRemainingMs = info.castRemainingMs CleveRoids.CurrentSpell.castEndTime = info.castEndS CleveRoids.CurrentSpell.gcdRemainingMs = info.gcdRemainingMs diff --git a/NampowerAPI.lua b/NampowerAPI.lua index 386759f..8de1f07 100644 --- a/NampowerAPI.lua +++ b/NampowerAPI.lua @@ -1177,7 +1177,11 @@ end function API.GetCastInfo() -- Use native function if available (v2.18+) if GetCastInfo then - return GetCastInfo() + local ok, result = pcall(GetCastInfo) + if ok then + return result + end + -- If pcall failed, fall through to fallback end -- Fallback: use GetCurrentCastingInfo (less detailed)