From 22312b602b26b171030f6bab1748b629d27cb29a Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 1 Jan 2017 15:19:23 +0100 Subject: [PATCH] cooldown: fix nil index in use with other addons --- modules/cooldown.lua | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/cooldown.lua b/modules/cooldown.lua index bc7dab04..e4c19e06 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -9,8 +9,16 @@ pfUI:RegisterModule("cooldown", function () cooldown.cd.text:SetPoint("CENTER", cooldown.cd, "CENTER", 0, 1) cooldown.cd:SetScript("OnUpdate", function() - if not this:GetParent() then this:Hide() end - if not getglobal(this:GetParent():GetName() .. "Cooldown"):IsShown() then this:Hide() end + if not this:GetParent() then + this:Hide() + end + + if this:GetParent() and this:GetParent():GetName() and getglobal(this:GetParent():GetName() .. "Cooldown") then + if not getglobal(this:GetParent():GetName() .. "Cooldown"):IsShown() then + this:Hide() + end + end + if not this.next then this.next = GetTime() + .1 end if this.next > GetTime() then return end this.next = GetTime() + .1 @@ -54,9 +62,9 @@ pfUI:RegisterModule("cooldown", function () -- realign guessed cooldown frames if this:GetParent() and this:GetParent():GetWidth() / 36 > 0 then - this:SetScale(this:GetParent():GetWidth() / 36) - this:SetPoint("TOPLEFT", this:GetParent(), "TOPLEFT", 0, 0) - this:SetPoint("BOTTOMRIGHT", this:GetParent(), "BOTTOMRIGHT", 1, -1) + this:SetScale(this:GetParent():GetWidth() / 36) + this:SetPoint("TOPLEFT", this:GetParent(), "TOPLEFT", 0, 0) + this:SetPoint("BOTTOMRIGHT", this:GetParent(), "BOTTOMRIGHT", 1, -1) end -- print time as text on cooldown frames