Thread Tools Display Modes
06-01-23, 11:41 PM   #1
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Question attempt to concatenate local 'playerName' (a nil value)

Hey, I need your help.
My addon GildenSteuer sometimes shows the error after porting from a dungeon or using a portal:

1x GildenSteuer\GildenSteuer-3.4.lua:377: attempt to concatenate local 'playerName' (a nil value)

That is the line with the error:
Lua Code:
  1. self:Debug("Add status request for " .. playerName .. " to queue")

Here is the Lines:
Lua Code:
  1. function GildenSteuer:RequestStatus(playerName, timestamp)
  2.     self:Debug("Add status request for " .. playerName .. " to queue")
  3.     if timestamp == nil then
  4.         timestamp = self:GetPlayerStatusDB(playerName, true).timestamp
  5.     end
  6.     local data = {"S", playerName}
  7.     if timestamp ~= nil then
  8.         table.insert(data, timestamp)
  9.     end
  10.     table.insert(self.outgoingQueue, data)
  11. end

I hope anyone can help me.
Attached Files
File Type: zip GildenSteuer.zip (206.5 KB, 45 views)

Last edited by BloodDragon : 06-01-23 at 11:43 PM.
  Reply With Quote
06-02-23, 06:00 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,854
Have you checked that the playerName being passed isn't nil for some reason before calling the function ?

I see you are setting up PlayerName at the OnEnteringWorld event but, is it possible some of the functions accessing it are being called in before then ?

What I would do in your situation

Do a debug run on each function that uses PlayerName and see what order they run through and if there is a time where PlayerName is nil when used. If there is, and its a valid reason for it to be nil you can just check for not nil before continuing that function.
__________________
  Reply With Quote
06-02-23, 12:47 PM   #3
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Either I'm stupid or I don't know. I can't find the error.
  Reply With Quote
06-02-23, 02:34 PM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,358
Well GetGuildRosterInfo (and other API that rely on a roundtrip to server for information) don't always provide valid data early in the loading process.

You can either monitor GUILD_ROSTER_UPDATE or check that name is not _G.UNKNOWNOBJECT and level return is valid before trying to use the returns.

This is all assuming the addon doesn't try to call GetGuildRosterInfo on an unguilded character.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » attempt to concatenate local 'playerName' (a nil value)

Thread Tools
Display Modes

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