Bagnon

Bagnon

122M Downloads

Lua error at BagBrother/core/features/caching.lua:93, table index is nil

b-morgan opened this issue ยท 3 comments

commented

Which software were you running?

  • Addon version name: Bagnon 10.1.9
  • Client used: WotLK Classic (3.4.2)

Have you read the changelog?
Yes

Please describe the bug.
Lua error at BagBrother/core/features/caching.lua:93, table index is nil

Please describe how to reproduce it.

  1. I just took a portal from Dalaran to Shattrath

The fix applied to this line from 10.1.8 to 10.1.9 eliminated the first error reported in #1762 with the quantity being nil but not the error caused by the id being nil.

Any Screenshots?
If applicable, please add screenshots to help explain your problem.

Error Logs are Important!

2x BagBrother/core/features/caching.lua:93: table index is nil
[string "@BagBrother/core/features/caching.lua"]:93: in function `?'
[string "@Accountant_Classic/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:109: in function <...sic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:109>
[string "=[C]"]: ?
[string "@Accountant_Classic/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...sic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:15>
[string "@Accountant_Classic/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function `Fire'
[string "@Accountant_Classic/Libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <...ccountant_Classic/Libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self = <table> {
 SendSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:82
 ParseItem = <function> defined @BagBrother/core/features/caching.lua:187
 RegisterMessage = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
 UnregisterMessage = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
 SaveBag = <function> defined @BagBrother/core/features/caching.lua:158
 PLAYER_EQUIPMENT_CHANGED = <function> defined @BagBrother/core/features/caching.lua:80
 SaveEquip = <function> defined @BagBrother/core/features/caching.lua:183
 player = <table> {
 }
 SendMessage = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
 GUILDBANKBAGSLOTS_CHANGED = <function> defined @BagBrother/core/features/caching.lua:132
 UnregisterAllEvents = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
 UnregisterSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:78
 VAULT_CLOSE = <function> defined @BagBrother/core/features/caching.lua:119
 PLAYER_MONEY = <function> defined @BagBrother/core/features/caching.lua:88
 BANK_CLOSE = <function> defined @BagBrother/core/features/caching.lua:107
 RegisterEvent = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
 UnregisterAllMessages = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
 CURRENCY_TRACKED_CHANGED = <function> defined @BagBrother/core/features/caching.lua:96
 NewModule = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:68
 PLAYER_LEVEL_UP = <function> defined @BagBrother/core/features/caching.lua:84
 OnEnable = <function> defined @BagBrother/core/features/caching.lua:20
 BAG_UPDATE = <function> defined @BagBrother/core/features/caching.lua:74
 RegisterSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:74
 CURRENCY_DISPLAY_UPDATE = <function> defined @BagBrother/core/features/caching.lua:92
 GUILD_ROSTER_UPDATE = <function> defined @BagBrother/core/features/caching.lua:128
 UnregisterEvent = <function> defined @Accountant_Classic/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
 Tag = "BAGNON_"
}
_ = "CURRENCY_DISPLAY_UPDATE"
id = nil
quantity = nil
(*temporary) = <table> {
 1901 = 636
 81 = 43
 tracked = <table> {
 }
}
(*temporary) = nil
(*temporary) = "table index is nil"
commented

Same issue

210x BagBrother/core/features/caching.lua:93: table index is nil
[string "@BagBrother/core/features/caching.lua"]:93: in function ?' [string "@Ace3/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:109: in function <...Ons/Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:109> [string "=[C]"]: ? [string "@Ace3/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...Ons/Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:15> [string "@Ace3/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function Fire'
[string "@Ace3/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <Ace3/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self =

{
SendSignal = defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:82
ParseItem = defined @BagBrother/core/features/caching.lua:187
RegisterMessage = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterMessage = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
SaveBag = defined @BagBrother/core/features/caching.lua:158
PLAYER_EQUIPMENT_CHANGED = defined @BagBrother/core/features/caching.lua:80
SaveEquip = defined @BagBrother/core/features/caching.lua:183
player =
{
}
SendMessage = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
GUILDBANKBAGSLOTS_CHANGED = defined @BagBrother/core/features/caching.lua:132
UnregisterAllEvents = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
UnregisterSignal = defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:78
VAULT_CLOSE = defined @BagBrother/core/features/caching.lua:119
PLAYER_MONEY = defined @BagBrother/core/features/caching.lua:88
BANK_CLOSE = defined @BagBrother/core/features/caching.lua:107
RegisterEvent = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterAllMessages = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
CURRENCY_TRACKED_CHANGED = defined @BagBrother/core/features/caching.lua:96
NewModule = defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:68
PLAYER_LEVEL_UP = defined @BagBrother/core/features/caching.lua:84
OnEnable = defined @BagBrother/core/features/caching.lua:20
BAG_UPDATE = defined @BagBrother/core/features/caching.lua:74
RegisterSignal = defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:74
CURRENCY_DISPLAY_UPDATE = defined @BagBrother/core/features/caching.lua:92
GUILD_ROSTER_UPDATE = defined @BagBrother/core/features/caching.lua:128
UnregisterEvent = defined @Ace3/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
Tag = "BAGNON_"
}
_ = "CURRENCY_DISPLAY_UPDATE"
id = nil
quantity = nil
(*temporary) =
{
2087 = 1
2088 = 2
1585 = 286528
tracked =
{
}
2533 = 8
2032 = 4275
1586 = 35
1560 = 236
2021 = 3
2003 = 263
1166 = 315
}
(*temporary) = nil
(*temporary) = "table index is nil"

commented

Temporary fix:
change line 93 from
self.player.currency[id] = (quantity or 0) > 0 and quantity or nil
to

	if id then
		self.player.currency[id] = (quantity or 0) > 0 and quantity or nil
	end

I did not test for side effects except the "missing" error.
Basically the UPDATE should still trigger on any real update, but is skipped if an update without ID is fired.

commented

Thank you.