WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   attempt to concatenate local 'playerName' (a nil value) (https://www.wowinterface.com/forums/showthread.php?t=59602)

BloodDragon 06-01-23 11:41 PM

attempt to concatenate local 'playerName' (a nil value)
 
1 Attachment(s)
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.

Xrystal 06-02-23 06:00 AM

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.

BloodDragon 06-02-23 12:47 PM

Either I'm stupid or I don't know. I can't find the error.

Dridzt 06-02-23 02:34 PM

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.


All times are GMT -6. The time now is 03:43 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI