diff --git a/FloFlyout.lua b/FloFlyout.lua index 79f1bda..8150f74 100755 --- a/FloFlyout.lua +++ b/FloFlyout.lua @@ -70,6 +70,10 @@ local L = FLOFLYOUT_L10N_STRINGS -- Functions ------------------------------------------------------------------------------- +function isEmpty(s) + return s == nil or s == '' +end + function FloFlyout.ReadCmd(line) local cmd, arg1, arg2 = strsplit(' ', line or "", 3); @@ -228,7 +232,7 @@ function FloFlyoutFrame_OnEvent(self, event, ...) if event == "SPELL_UPDATE_COOLDOWN" then local i = 1 local button = _G[self:GetName().."Button"..i] - while (button and button:IsShown() and button.spellID) do + while (button and button:IsShown() and not isEmpty(button.spellID)) do SpellFlyoutButton_UpdateCooldown(button) i = i+1 button = _G[self:GetName().."Button"..i] @@ -437,11 +441,11 @@ local function Opener_PreClick(self, button, down) local buttonList = { FloFlyoutFrame:GetChildren() } table.remove(buttonList, 1) for i, buttonRef in ipairs(buttonList) do - if spellList[i] then - buttonRef.spellID = spellList[i] - buttonRef.actionType = typeList[i] - local icon = FloFlyout:GetTexture(typeList[i], spellList[i]) - _G[buttonRef:GetName().."Icon"]:SetTexture(icon) + buttonRef.spellID = spellList[i] + buttonRef.actionType = typeList[i] + local icon = FloFlyout:GetTexture(typeList[i], spellList[i]) + _G[buttonRef:GetName().."Icon"]:SetTexture(icon) + if not isEmpty(spellList[i]) then SpellFlyoutButton_UpdateCooldown(buttonRef) SpellFlyoutButton_UpdateState(buttonRef) SpellFlyoutButton_UpdateUsable(buttonRef) @@ -588,15 +592,17 @@ function FloFlyout:CreateOpener(name, idFlyout, actionId, direction, actionButto _classicUI.LayoutActionButton(opener, typeActionButton) opener:SetScale(actionButton:GetScale()) end - if actionButton:GetSize() and actionButton:IsRectValid() then - opener:SetAllPoints(actionButton) - else - local spacerName = "ActionBarButtonSpacer"..tostring(actionButton.index) - local children = {actionButton:GetParent():GetChildren()} - for _, child in ipairs(children) do - if child:GetName() == spacerName then - opener:SetAllPoints(child) - break; + if actionButton then + if actionButton:GetSize() and actionButton:IsRectValid() then + opener:SetAllPoints(actionButton) + else + local spacerName = "ActionBarButtonSpacer"..tostring(actionButton.index) + local children = {actionButton:GetParent():GetChildren()} + for _, child in ipairs(children) do + if child:GetName() == spacerName then + opener:SetAllPoints(child) + break; + end end end end diff --git a/README.md b/README.md new file mode 100644 index 0000000..97b5fde --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# FloFlyout +wow addon to provide custom flyout menus - created by Boboseb