fix: guard legacy InterfaceOptions globals for CoA client
The CoA client's reworked Settings panel does not expose InterfaceOptionsCombatPanelNameplateClassColors or InterfaceOptionsCombatPanelEnemyCastBarsOnNameplates, causing a nil-index error whenever the Combat options panel was shown. Guard each access in ClassColours and Castbar.
This commit is contained in:
@@ -402,13 +402,20 @@ function mod:OnInitialize()
|
||||
self.configChangedFuncs.display.cbheight.ro(sizes.cbheight)
|
||||
|
||||
-- handle default interface cvars & checkboxes
|
||||
-- The CoA client's reworked Settings panel may not expose these legacy
|
||||
-- globals; guard each access so a missing widget cannot error every time
|
||||
-- the Combat options panel is shown.
|
||||
if InterfaceOptionsCombatPanel then
|
||||
InterfaceOptionsCombatPanel:HookScript(
|
||||
"OnShow",
|
||||
function()
|
||||
if InterfaceOptionsCombatPanelEnemyCastBarsOnNameplates then
|
||||
InterfaceOptionsCombatPanelEnemyCastBarsOnNameplates:SetChecked(true)
|
||||
InterfaceOptionsCombatPanelEnemyCastBarsOnNameplates:Disable()
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
InterfaceOptionsFrame:HookScript(
|
||||
"OnHide",
|
||||
function()
|
||||
|
||||
@@ -94,11 +94,18 @@ function mod:OnInitialize()
|
||||
self:SetEnabledState(self.db.profile.friendly)
|
||||
|
||||
-- handle default interface cvars & checkboxes
|
||||
-- The CoA client's reworked Settings panel does not expose the legacy
|
||||
-- InterfaceOptionsCombatPanel / NameplateClassColors checkbox, so guard
|
||||
-- every access to avoid indexing a nil global.
|
||||
if InterfaceOptionsCombatPanel then
|
||||
InterfaceOptionsCombatPanel:HookScript("OnShow", function()
|
||||
if InterfaceOptionsCombatPanelNameplateClassColors then
|
||||
InterfaceOptionsCombatPanelNameplateClassColors:Disable()
|
||||
InterfaceOptionsCombatPanelNameplateClassColors:SetChecked(mod.db.profile.enemy)
|
||||
InterfaceOptionsCombatPanelNameplateClassColors.Enable = function() return end
|
||||
end
|
||||
end)
|
||||
end
|
||||
InterfaceOptionsFrame:HookScript("OnHide", function() SetCVars() end)
|
||||
SetCVars()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user