Skip to content

Commit 705f7ed

Browse files
committed
TT: health percent error in bg
1 parent 767a020 commit 705f7ed

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ElvUI/Game/Shared/Modules/Tooltip/Tooltip.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ local UnitGUID = UnitGUID
4343
local UnitHasVehicleUI = UnitHasVehicleUI
4444
local UnitHealth = UnitHealth
4545
local UnitHealthMax = UnitHealthMax
46+
local UnitHealthPercent = UnitHealthPercent
4647
local UnitInParty = UnitInParty
4748
local UnitInRaid = UnitInRaid
4849
local UnitIsBattlePetCompanion = UnitIsBattlePetCompanion
@@ -59,7 +60,6 @@ local UnitRace = UnitRace
5960
local UnitReaction = UnitReaction
6061
local UnitRealmRelationship = UnitRealmRelationship
6162
local UnitSex = UnitSex
62-
local UnitHealthPercent = UnitHealthPercent
6363

6464
local TooltipDataType = Enum.TooltipDataType
6565
local ScaleTo100 = CurveConstants and CurveConstants.ScaleTo100
@@ -657,8 +657,9 @@ function TT:GameTooltipStatusBar_UpdateUnitHealth(bar)
657657

658658
local tt = bar:GetParent()
659659
local unit = TT:GetUnitToken(tt)
660-
if unit then
661-
bar.Text:SetFormattedText('%d', UnitHealthPercent(unit, true, ScaleTo100))
660+
local _, perc = pcall(UnitHealthPercent, unit, true, ScaleTo100)
661+
if perc then
662+
bar.Text:SetFormattedText('%d', perc)
662663
else
663664
bar.Text:SetText('')
664665
end

0 commit comments

Comments
 (0)