Thread Tools Display Modes
01-29-10, 08:12 PM   #1
Toran
A Nerdscale Dorkin
 
Toran's Avatar
Premium Member
Join Date: May 2006
Posts: 143
Name update error

Hi,

I get an error that seems to only spawn when I'm forced off my mount in the argent tournament area. Error is:

Code:
layout.lua:192: bad argument #1 to 'lower' (string expected, got nil)
layout.lua:192: in function `UNIT_NAME_UPDATE'
layout.lua:276: in function <oUF_Lyn\layout.lua:214>
Code involved in the "name update" area is:

Code:
local updateName = function(self, event, unit)
	if(self.unit ~= unit) then return end

	local name = UnitName(unit)
    self.Name:SetText(string.lower(name))
	
	if unit=="targettarget" then
		local totName = UnitName(unit)
		local pName = UnitName("player")
		if totName==pName then
			self.Name:SetTextColor(0.9, 0.5, 0.2)
		else
			self.Name:SetTextColor(1,1,1)
		end
	else
		self.Name:SetTextColor(1,1,1)
	end
	   
    if unit=="target" then -- Show level value on targets only
		updateLevel(self, unit, name)      
    end
end
I boldfaced the part in the code that the error seems to align with. Anyone have an idea what is causing it and how to fix? Thank you!
  Reply With Quote
01-29-10, 08:42 PM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Not sure what would cause that; but you can fix it like this:

Code:
local name = UnitName(unit)
if not name then return end
self.Name:SetText(string.lower(name))

Last edited by Akryn : 01-29-10 at 08:44 PM.
  Reply With Quote
01-29-10, 08:43 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,968
It looks like there needs to be another check in there to validate that unit exists. If it only happens when you are forced off of your mount then it sounds like it was in the process of updating the mount's information and then lost the information mid calculation.

If you add the following line just above that offending line it should resolve the problem.

if ( not name ) then return end

Thus, if you weren't aware, not going any further if all of a sudden there is no unit to get details for.

Edit: D'oh beaten..
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
01-29-10, 09:02 PM   #4
Toran
A Nerdscale Dorkin
 
Toran's Avatar
Premium Member
Join Date: May 2006
Posts: 143
Worked great. Thanks for the fast replies.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Name update error


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off