From 12411b0e41cc7b9784d2a29eac4217034f57acb1 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Thu, 1 Jun 2023 19:13:08 -0700 Subject: [PATCH] Libs/oUF: clamp max sections to how many the element has --- ElvUI/Libraries/oUF/elements/classpower.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ElvUI/Libraries/oUF/elements/classpower.lua b/ElvUI/Libraries/oUF/elements/classpower.lua index f711de8..7b210ff 100644 --- a/ElvUI/Libraries/oUF/elements/classpower.lua +++ b/ElvUI/Libraries/oUF/elements/classpower.lua @@ -58,6 +58,8 @@ local ClassPowerID, ClassPowerType local ClassPowerEnable, ClassPowerDisable local RequireSpec, RequirePower, RequireSpell +local mathmin = math.min + local function UpdateColor(element, powerType) local color = element.__owner.colors.power[powerType] local r, g, b = color.r, color.g, color.b @@ -111,6 +113,7 @@ local function Update(self, event, unit, powerType) max = powerType == 'COMBO_POINTS' and GetComboPoints(unit, 'target') or UnitPower(unit, powerID) cur = powerType == 'COMBO_POINTS' and GetComboPoints(unit, 'target') or UnitPower(unit, powerID) + max = mathmin(max or 0, element and #element or 0) local numActive = cur + 0.9 for i = 1, max do