Core Loot Manager DKP & EPGP & SK

Core Loot Manager DKP & EPGP & SK

2M Downloads

Script Errors

lantisnt opened this issue ยท 1 comments

commented

Describe the bug

Message: Interface\AddOns\ClassicLootManager\Utils.lua:201: bad argument #2 to 'strsplit' (string expected, got nil)
Time: Wed Nov 24 00:04:51 2021
Count: 1
Stack: Interface\AddOns\ClassicLootManager\Utils.lua:201: bad argument #2 to 'strsplit' (string expected, got nil)
[string "@Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua"]:761: in function <...Ons\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:717>
[string "=[C]"]: ?
[string "=[C]"]: in function strsplit'
[string "@Interface\AddOns\ClassicLootManager\Utils.lua"]:201: in function <Interface\AddOns\ClassicLootManager\Utils.lua:200>
[string "@Interface\AddOns\ClassicLootManager\Modules\ACL\GuildInfoListener.lua"]:56: in function BuildTrustedCache'
[string "@Interface\AddOns\ClassicLootManager\Modules\ACL\GuildInfoListener.lua"]:28: in function BuildCache'
[string "@Interface\AddOns\ClassicLootManager\Modules\ACL\GuildInfoListener.lua"]:73: in function GetInfo'
[string "@Interface\AddOns\ClassicLootManager\Modules\ACL\ACL.lua"]:26: in function `CheckLevel'
[string "@Interface\AddOns\ClassicLootManager\Modules\Comms\Comms.lua"]:112: in function <...ce\AddOns\ClassicLootManager\Modules\Comms\Comms.lua:94>
[string "=(tail call)"]: ?
[string "@Interface\AddOns\ClassicLootManager\ExternalLibs\lua-eventsourcing\source\ListSync.lua"]:39: in function <...r\ExternalLibs\lua-eventsourcing\source\ListSync.lua:38>
[string "@Interface\AddOns\ClassicLootManager\ExternalLibs\lua-eventsourcing\source\ListSync.lua"]:487: in function <...r\ExternalLibs\lua-eventsourcing\source\ListSync.lua:435>
[string "@Interface\SharedXML\C_TimerAugment.lua"]:16: in function <Interface\SharedXML\C_TimerAugment.lua:14>

Locals: errMsg = "Interface\AddOns\ClassicLootManager\Utils.lua:201: bad argument #2 to 'strsplit' (string expected, got nil)"
isBugGrabber = nil
tsmErrMsg = nil
oldModule = nil
private = <table> {
 globalNameTranslation = <table> {
 }
 FormatErrorMessageSection = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:517
 ErrorHandler = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:134
 origErrorHandler = <function> defined @Interface\SharedXML\SharedBasicControls.lua:296
 hitInternalError = false
 CreateErrorFrame = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:536
 num = 0
 SanitizeString = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:510
 AddonBlockedHandler = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:502
 GetStackLevelInfo = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:344
 ParseLocals = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:396
 ignoreErrors = false
 errorReports = <table> {
 }
 IsTSMAddon = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:478
 localLinesTemp = <table> {
 }
 GetStackInfo = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:313
}
MAX_STACK_DEPTH = 50
OLD_TSM_MODULES = <table> {
 1 = "TradeSkillMaster_Accounting"
 2 = "TradeSkillMaster_AuctionDB"
 3 = "TradeSkillMaster_Auctioning"
 4 = "TradeSkillMaster_Crafting"
 5 = "TradeSkillMaster_Destroying"
 6 = "TradeSkillMaster_Mailing"
 7 = "TradeSkillMaster_Shopping"
 8 = "TradeSkillMaster_Vendoring"
 9 = "TradeSkillMaster_Warehousing"
}

To Reproduce
Randomly after heartstoning after loggin.

commented

You should do some proper type checking in the utils lib.
Something like this: https://github.com/SamMousa/lua-eventsourcing/blob/master/source/Util.lua#L266

But then also pass a 2nd argument to error(). This argument is a number and by setting it to 2 you'll get a proper stack trace of the call site calling your code with bad inputs..

In this case, this is the bad call: https://github.com/ClassicLootManager/ClassicLootManager/blob/master/Modules/ACL/GuildInfoListener.lua#L56

Looking at it I suspect some addon is overriding GetGuildRosterInfo() and not returning a name.
You should assert each of the returned variables from it. In this case specifically you have a race condition.
You call GetNumGuildMembers() to get the range of guild members, but then while iterating over it, the length could change.
In which case I suspect GetGuildRosterInfo() silently fails returning nil. Checking for nil should solve the issue.

 for i=1,GetNumGuildMembers() do
    local name, rankName, rankIndex = GetGuildRosterInfo(i)
    if (name == nil) then 
        continue
    end