coa.13: fix character-view crash on chars with >2 professions
release / release (push) Successful in 5s
release / release (push) Successful in 5s
SetItemButtonTexture now guards a nil IconTexture (was crashing whenever a button didn't exist). UpdateViewIcons profession loop stops at the last existing _ProfN button instead of indexing a nil frame; added _Prof3..8 so CoA chars (which can know many professions) show more than 2. This was blocking the character detail view from rendering when you clicked a char in the Account Summary.
This commit is contained in:
@@ -495,6 +495,7 @@ 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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -227,10 +227,14 @@ 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
|
||||
@@ -243,6 +247,12 @@ function ns:UpdateViewIcons()
|
||||
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)
|
||||
|
||||
@@ -257,6 +257,50 @@
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<!-- CoA: characters can know many more than 2 primary professions. Extra slots;
|
||||
UpdateViewIcons fills/hides them dynamically and stops at the last one. -->
|
||||
<Button name="$parent_Prof3" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof2" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="$parent_Prof4" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof3" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="$parent_Prof5" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof4" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="$parent_Prof6" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof5" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="$parent_Prof7" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof6" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
<Button name="$parent_Prof8" inherits="AltoViewIconTemplate" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof7" relativePoint="BOTTOMRIGHT" >
|
||||
<Offset x="5" y="0" />
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Button>
|
||||
|
||||
<Button name="$parent_Sort1" inherits="AltoSortButtonTemplate" id="1">
|
||||
<Size>
|
||||
|
||||
Reference in New Issue
Block a user