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.
This commit is contained in:
Parnic
2022-12-19 12:19:10 -06:00
parent c5c44edf64
commit 7496475ff4
3 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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