From d83f1fe396e071c6dbafcad9b10b95df57d46d64 Mon Sep 17 00:00:00 2001 From: Britt Yazel Date: Fri, 22 Dec 2023 19:11:19 -0800 Subject: [PATCH] Attempt to fix IsShown() erroring on UpdateInRange --- Overrides.lua | 2 +- Utils/Utilities.lua | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Overrides.lua b/Overrides.lua index 545bbd8..f9f0874 100644 --- a/Overrides.lua +++ b/Overrides.lua @@ -100,7 +100,7 @@ end --- This function is secure hooked to the CompactUnitFrame_UpdateInRange function. ---@param frame table @The frame to update the alpha on function EnhancedRaidFrames:UpdateInRange(frame) - if not self.ShouldContinue(frame) then + if not self.ShouldContinue(frame, true) then return end diff --git a/Utils/Utilities.lua b/Utils/Utilities.lua index 145f492..d24d8c7 100644 --- a/Utils/Utilities.lua +++ b/Utils/Utilities.lua @@ -23,6 +23,13 @@ function EnhancedRaidFrames.ShouldContinue(frame, skipVisibilityCheck) return false end + -- Check that we have a unit, and only process player, raid, and party units + if not frame.unit or (not frame.unit:find("player", 1, true) + and not frame.unit:find("raid", 1, true) + and not frame.unit:find("party", 1, true)) then + return false + end + -- Check that we have a frame and that it is visible if not skipVisibilityCheck then -- Don't do any work if the raid frames aren't shown @@ -30,18 +37,12 @@ function EnhancedRaidFrames.ShouldContinue(frame, skipVisibilityCheck) return false end - if frame and not frame:IsShown() then + -- Don't do any work if the frame isn't shown + if not frame:IsShown() then return false end end - -- Check that we have a unit, and only process player, raid, and party units - if not frame.unit or (not frame.unit:find("player", 1, true) - and not frame.unit:find("raid", 1, true) - and not frame.unit:find("party", 1, true)) then - return false - end - return true end