Quantcast

Restructured code to avoid an error on R_R_U

James Whitehead II [01-15-07 - 23:38]
Restructured code to avoid an error on R_R_U
Filename
PerfectRaid.lua
diff --git a/PerfectRaid.lua b/PerfectRaid.lua
index a385771..1a2631c 100644
--- a/PerfectRaid.lua
+++ b/PerfectRaid.lua
@@ -385,20 +385,20 @@ local function OnAttributeChanged(frame, name, value)
 		end
 	end

-	local unitname = UnitName(value)
-	if not frame.unit then
+	if value then
+		local unitname = UnitName(value)
+		if not frame.unit then
+			frame.unit = value
+			frame.unitname = unitname
+		else
+			if frame.unit == value and frame.unitname == unitname then
+				return
+			end
+		end
+
 		frame.unit = value
 		frame.unitname = unitname
-	else
-		if frame.unit == value and frame.unitname == unitname then
-			return
-		end
-	end
-
-	frame.unit = value
-	frame.unitname = unitname

-	if value then
 		-- Do Visual Configuration here
 		local unit = value
 		frame.name:SetText(self:GetColoredName(unit))