From f14ffbe0bdec66430e144e1a47e2b9d7747530f3 Mon Sep 17 00:00:00 2001 From: omicron Date: Sat, 18 Mar 2023 16:35:02 +0100 Subject: [PATCH] Handle characters that aren't fully loaded yet in UpdateName --- src/types/unitframe.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/types/unitframe.lua b/src/types/unitframe.lua index bc05890..01ff008 100644 --- a/src/types/unitframe.lua +++ b/src/types/unitframe.lua @@ -446,7 +446,10 @@ end function UnitFrame:UpdateName() if UnitIsPlayer(self.unit) then local _, class = UnitClass(self.unit) - local color = RAID_CLASS_COLORS[class] + -- TODO: UnitClass can return Unknown and the color can be nil. Having + -- the unit exist but not fully loaded is possibly a state we want to + -- handle more generally + local color = RAID_CLASS_COLORS[class] or {r=1, g=1, b=1} self.name:SetTextColor(color.r, color.g, color.b) else self.name:SetTextColor(1, 1, 1)