Kiatra / ChocolateBar

ChocolateBar is a World of Warcraft addons to display plugins in a bar on top or bottom of your screen
https://www.wowace.com/projects/chocolatebar
18 stars 9 forks source link

Lua error on login since patch 9.2 #15

Closed cremor closed 2 years ago

cremor commented 2 years ago

Since path 9.2 I always get this Lua error on the first login with a just started client. Later relogs or UI reloads do not trigger the error.

2x ChocolateBar\modules\CB_PlayedTime.lua:70: bad argument #2 to 'format' (string expected, got nil)
[string "=[C]"]: in function `format'
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:70: in function <ChocolateBar\modules\CB_PlayedTime.lua:65>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:78: in function <ChocolateBar\modules\CB_PlayedTime.lua:77>

Locals:
(*temporary) = "%s-%s"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "string expected, got nil"

Using ChocolateBar v3.8

A few debug infos:

Dump: value=GetPlayerInfoByGUID(UnitGUID("player"))
[1]="Paladin",
[2]="PALADIN",
[3]="Mensch",
[4]="Human",
[5]=2,
[6]="my char name",
[7]=""

Dump: value=GetNormalizedRealmName()
[1]="my realm name"

Since those values all look ok, and later relogs or UI reloads do not trigger the error, I assume it is just a timing error. The values are not yet available when the code is first executed.

Cluuey commented 2 years ago

I got this too so hopefully it's common enough to debug quickly. No idea how you got the extra debug info but the rest of mine is the same.

[string "=[C]"]: in function `format'
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:70: in function <ChocolateBar\modules\CB_PlayedTime.lua:65>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:78: in function <ChocolateBar\modules\CB_PlayedTime.lua:77>

Locals:
(*temporary) = "%s-%s"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "string expected, got nil"
cremor commented 2 years ago

@Kiatra This is not fixed in v3.8.1!

2x ChocolateBar\modules\CB_PlayedTime.lua:70: bad argument #2 to 'format' (string expected, got nil)
[string "=[C]"]: in function `format'
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:70: in function <ChocolateBar\modules\CB_PlayedTime.lua:65>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:78: in function <ChocolateBar\modules\CB_PlayedTime.lua:77>

Locals:
(*temporary) = "%s-%s"
(*temporary) = nil
(*temporary) = "Blackmoore"
(*temporary) = "string expected, got nil"
Kiatra commented 2 years ago

ah yes apparently, this error pups up only first login...

Kiatra commented 2 years ago

Fixed with 3.8.2

cremor commented 2 years ago

@Kiatra Sorry, but this is still not fixed in v3.8.2:

1x ChocolateBar\modules\CB_PlayedTime.lua:66: bad argument #2 to 'format' (string expected, got nil)
[string "=[C]"]: in function `format'
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:66: in function <ChocolateBar\modules\CB_PlayedTime.lua:60>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:74: in function <ChocolateBar\modules\CB_PlayedTime.lua:73>

Locals:
(*temporary) = "%s-%s"
(*temporary) = nil
(*temporary) = "Blackmoore"
(*temporary) = "string expected, got nil"

You changed the function onEnteringWorld, but the error actually comes from the call in the function playedTimeEvent.

Cluuey commented 2 years ago

I'm getting the same error, I've gone back to the pull request icbat made.

Kiatra commented 2 years ago

@cremor, in 3.8.2 The function onEnteringWorld got a 2 second timer delay on the call for RequestTimePlayed() this triggers the playedTimeEvent. That fixed it for me.

I tried a different API in UnitFullName("player") for the getting the char name and realm, that seems more stable in the latest commit 166711367400b76c7dc067e03b34384606bcd884 can you tray that one out before I release it?

cremor commented 2 years ago

Sorry for not replying earlier, but I couldn't test until now. I just tested 3.8.3 and it seems to fix the problem, thanks!

cremor commented 2 years ago

@Kiatra Bad news. While the error on login seems to be fixed, I just got a new - but similar - error when using my hearthstone. This time it's the realm name that is nil.

1x ChocolateBar\modules\CB_PlayedTime.lua:62: bad argument #3 to 'format' (string expected, got nil)
[string "=[C]"]: in function `format'
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:62: in function <ChocolateBar\modules\CB_PlayedTime.lua:60>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:86: in function <ChocolateBar\modules\CB_PlayedTime.lua:85>
[string "@ChocolateBar\modules\CB_PlayedTime.lua"]:98: in function `func'
[string "@BagSync\libs\AceTimer-3.0\AceTimer-3.0-17.lua"]:57: in function <...ceBagSync\libs\AceTimer-3.0\AceTimer-3.0.lua:50>

Locals:
(*temporary) = "%s-%s"
(*temporary) = "Cremor"
(*temporary) = nil
(*temporary) = "string expected, got nil"
cremor commented 2 years ago

Seems like this is now completely fixed in v3.8.4, thanks!