View Single Post
01-27-11, 01:07 AM   #10
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Kendian View Post
This is doing the same thing.....it's fine if I click on target to target, but everytime I DEselect a target (no target at all) it throws a huge error >.<


Message: [string "a_OnEvent"]:3: attempt to index local 'Color' (a nil value)
Time: 01/27/11 00:57:24
Count: 3
Stack: [string "a_OnEvent"]:3: in function <[string "a_OnEvent"]:1>
[C]: in function `CameraOrSelectOrMoveStop'
[string "CAMERAORSELECTORMOVE"]:4: in function <[string "CAMERAORSELECTORMOVE"]:1>

Locals: self = kgPanel1 {
0 = <userdata>
missing_parent_at_load = false
missing_anchor_at_load = false
text = <unnamed> {
}
bg = <unnamed> {
}
scripts_loaded = false

Is the gist of it.
Ahh, thought you were already accounting for no target situations. Here you go:

Code:
if UnitExists("target") then
  local _, Class = UnitClass("target")
  local Color = RAID_CLASS_COLORS[Class] or {r = 1, g = 1, b = 1}
  self:SetBackdropBorderColor(Color.r, Color.g, Color.b, self.bg:GetAlpha())
end
  Reply With Quote