From 7496475ff43bad9027123fc8515da847b9faaee0 Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 19 Dec 2022 12:19:10 -0600 Subject: [PATCH] Fix potential nil access I can't reproduce a problem here, but based on some user feedback, this could potentially be an issue. Most other modules are calling the super's Update() first thing, but these modules call them later, so healthPercentage may not be defined at this point. --- modules/CustomHealth.lua | 2 +- modules/TargetOfTargetHealth.lua | 2 +- modules/TargetOfTargetMana.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/CustomHealth.lua b/modules/CustomHealth.lua index 09faf4b..eda2061 100644 --- a/modules/CustomHealth.lua +++ b/modules/CustomHealth.lua @@ -144,7 +144,7 @@ function IceCustomHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" - elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage and self.healthPercentage <= self.moduleSettings.lowThreshold then self.color = "ScaledHealthColor" end diff --git a/modules/TargetOfTargetHealth.lua b/modules/TargetOfTargetHealth.lua index a4de879..2c1cdde 100644 --- a/modules/TargetOfTargetHealth.lua +++ b/modules/TargetOfTargetHealth.lua @@ -136,7 +136,7 @@ function TargetTargetHealth.prototype:Update(unit) if (self.moduleSettings.scaleHealthColor) then self.color = "ScaledHealthColor" - elseif self.moduleSettings.lowThresholdColor and self.healthPercentage <= self.moduleSettings.lowThreshold then + elseif self.moduleSettings.lowThresholdColor and self.healthPercentage and self.healthPercentage <= self.moduleSettings.lowThreshold then self.color = "ScaledHealthColor" end diff --git a/modules/TargetOfTargetMana.lua b/modules/TargetOfTargetMana.lua index 89bbf2f..9b8a6cd 100644 --- a/modules/TargetOfTargetMana.lua +++ b/modules/TargetOfTargetMana.lua @@ -83,7 +83,7 @@ function TargetTargetMana.prototype:Update(unit) if (self.moduleSettings.scaleManaColor) then self.color = "ScaledManaColor" - elseif self.moduleSettings.lowThresholdColor and self.manaPercentage <= self.moduleSettings.lowThreshold then + elseif self.moduleSettings.lowThresholdColor and self.manaPercentage and self.manaPercentage <= self.moduleSettings.lowThreshold then self.color = "ScaledManaColor" end