From 17963ea776bc77e2a42cc72158f565c1f09c2b4d Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Thu, 21 Nov 2024 00:36:19 +0100 Subject: [PATCH 1/2] power: Store and forward the used minimum value correctly --- elements/power.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elements/power.lua b/elements/power.lua index bab26240..8fb5996f 100644 --- a/elements/power.lua +++ b/elements/power.lua @@ -219,7 +219,11 @@ local function Update(self, event, unit) end local cur, max = UnitPower(unit, displayType), UnitPowerMax(unit, displayType) - element:SetMinMaxValues(min or 0, max) + if not min then + min = 0 + end + + element:SetMinMaxValues(min, max) if(UnitIsConnected(unit)) then element:SetValue(cur) From 9d8a1479b690d9a801e887f287296d956d5d1b40 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Sat, 30 Nov 2024 13:37:19 +0100 Subject: [PATCH 2/2] Adjust for review, added a comment to it too --- elements/power.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/elements/power.lua b/elements/power.lua index 8fb5996f..caba329f 100644 --- a/elements/power.lua +++ b/elements/power.lua @@ -219,10 +219,7 @@ local function Update(self, event, unit) end local cur, max = UnitPower(unit, displayType), UnitPowerMax(unit, displayType) - if not min then - min = 0 - end - + min = min or 0 -- ensure we always have a minimum value to avoid errors element:SetMinMaxValues(min, max) if(UnitIsConnected(unit)) then