GetRaidRosterInfo occasionally returning nil

#0 - Jan. 16, 2007, 4:14 p.m.
Blizzard Post
I've been running into what appears to be a bug with the SecureRaidHeader ever since 2.0. In SecureRaidGroupHeader_Update, it calls GetRaidRosterInfo() for raid indexes 1 to GetNumRaidMembers() which is normally just fine. However, sometimes GetRaidRosterInfo() is returning nil (for at least the unit's name) and triggering an error message:

Date: 2007-01-15 05:01:04
ID: 51
Error occured in: Global
Count: 1
Message: ..\FrameXML\SecureTemplates.lua line 884:
table index is nil
Debug:
[C]: ?
..\FrameXML\SecureTemplates.lua:884: SecureRaidGroupHeader_Update()
[string "GridLayoutHeader1:OnShow"]:2:
[string "GridLayoutHeader1:OnShow"]:1
[C]: Show()
Grid\GridLayout.lua:760: LoadLayout()
Grid\GridLayout.lua:698: ReloadLayout()
Grid\GridLayout.lua:551:
Grid\GridLayout.lua:545

Line 884 is: sortingTable[name] = "raid"..i;
name is the nil value mentioned in the error message. name comes from GetRaidRosterInfo(i) on line 877. i comes from 1, GetNumRaidMembers() on line 876.

A simple check to see if name is not nil in the if that begins on line 878 would seem to be all that is necessary to avoid the error.

876| for i = 1, GetNumRaidMembers(), 1 do
877| local name, _, subgroup, _, _, className = GetRaidRosterInfo(i);
878| if ( ((not strictFiltering) and
879| (tokenTable[subgroup] or tokenTable[className]) -- non-strict filtering
880| ) or
881| (tokenTable[subgroup] and tokenTable[className]) -- strict filtering
882| ) then
883| tinsert(sortingTable, name);
884| sortingTable[name] = "raid"..i;
885| if ( groupBy == "GROUP" ) then
886| groupingTable[name] = subgroup;
887|
888| elseif ( groupBy == "CLASS" ) then
889| groupingTable[name] = className;
890|
891| end
892| end
893| end
#7 - May 3, 2007, 7:47 p.m.
Blizzard Post
The check for nil name has been added for 2.1.0 release, thanks!
#10 - May 3, 2007, 10:05 p.m.
Blizzard Post
That's not a bad idea... I'm not sure if it'll make 2.1.0 though.