diff --git a/Altoholic/Altoholic.lua b/Altoholic/Altoholic.lua index 26af057..8aee6ce 100644 --- a/Altoholic/Altoholic.lua +++ b/Altoholic/Altoholic.lua @@ -495,11 +495,12 @@ function addon:SetItemButtonTexture(button, texture, width, height) height = height or 36 local itemTexture = _G[button.."IconTexture"] - + if not itemTexture then return end -- CoA: guard buttons that don't exist / lack an IconTexture region (e.g. iterating more professions than there are _ProfN buttons) + itemTexture:SetWidth(width); itemTexture:SetHeight(height); itemTexture:SetAllPoints(_G[button]); - + SetItemButtonTexture(_G[button], texture) end diff --git a/Altoholic/Altoholic.toc b/Altoholic/Altoholic.toc index 155402e..6bfd1ea 100644 --- a/Altoholic/Altoholic.toc +++ b/Altoholic/Altoholic.toc @@ -13,7 +13,7 @@ ## Author: Thaoky, Telkar-RG ## X-Edited-By: Exiles (Sub-Net) — florian.berthold@sub-net.at -## Version: 3.3.002b-coa.12 +## Version: 3.3.002b-coa.13 ## X-Category: Inventory, Tradeskill, Mail ## X-Localizations: enUS, frFR, zhCN, zhTW, deDE, koKR, esES, esMX, ruRU ## X-Website: http://wow.curse.com/downloads/wow-addons/details/altoholic.aspx diff --git a/Altoholic/Frames/TabCharacters.lua b/Altoholic/Frames/TabCharacters.lua index 0b2babe..8cbd989 100644 --- a/Altoholic/Frames/TabCharacters.lua +++ b/Altoholic/Frames/TabCharacters.lua @@ -227,22 +227,32 @@ function ns:UpdateViewIcons() AltoholicTabCharacters_FirstAid.text = professionName AltoholicTabCharacters_FirstAid:Show() + -- CoA: characters can know far more than the retail 2 primary professions, so the + -- _ProfN button row may run out before the profession list does. Stop at the last + -- existing button instead of indexing a nil frame (which crashed the character view). local i = 1 - for skillName, skill in pairs(DS:GetPrimaryProfessions(character) or {}) do -- CoA: getter returns no value for chars DataStore_Crafts hasn't scanned + for skillName, skill in pairs(DS:GetPrimaryProfessions(character) or {}) do local itemName = "AltoholicTabCharacters_Prof" .. i local item = _G[itemName] + if not item then break end -- no more profession buttons available local spellID = DataStore:GetProfessionSpellID(skillName) - + if spellID then addon:SetItemButtonTexture(itemName, addon:GetSpellIcon(spellID), size, size) item.text = skillName item:Show() else item.text = nil - item:Hide() + item:Hide() end i = i + 1 end + -- Hide any leftover profession buttons this character doesn't fill. + while _G["AltoholicTabCharacters_Prof" .. i] do + _G["AltoholicTabCharacters_Prof" .. i].text = nil + _G["AltoholicTabCharacters_Prof" .. i]:Hide() + i = i + 1 + end end function ns:MenuItem_OnClick(frame, button) diff --git a/Altoholic/Frames/TabCharacters.xml b/Altoholic/Frames/TabCharacters.xml index 0a7c85e..80b2126 100644 --- a/Altoholic/Frames/TabCharacters.xml +++ b/Altoholic/Frames/TabCharacters.xml @@ -257,6 +257,50 @@ + + + + + + +