Skip to content

Commit

Permalink
Fix #239 prevent error when no member info
Browse files Browse the repository at this point in the history
It seems that in some rare cases C_LFGList.GetSearchResultMemberInfo returns a nil result.
  • Loading branch information
0xbs committed Feb 9, 2024
1 parent 601ec32 commit 4105af8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Modules/MemberInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ function PGF.GetSearchResultMemberInfoTable(resultID, numMembers)
for i = 1, numMembers do
local role, class, classLocalized, specLocalized = C_LFGList.GetSearchResultMemberInfo(resultID, i)
local specInfo = PGF.GetSpecializationInfoByLocalizedName(class, specLocalized)
local memberInfo = PGF.Table_Copy_Shallow(specInfo)
memberInfo.isLeader = i == 1
memberInfo.leaderMarkup = i == 1 and string.format("|A:%s:10:12:0:0|a", C.LEADER_ATLAS) or ""
table.insert(members, memberInfo)
if specInfo then
local memberInfo = PGF.Table_Copy_Shallow(specInfo)
memberInfo.isLeader = i == 1
memberInfo.leaderMarkup = i == 1 and string.format("|A:%s:10:12:0:0|a", C.LEADER_ATLAS) or ""
table.insert(members, memberInfo)
end
end
-- sort reverse by role -> tank, heal, dps; then by class
table.sort(members, function(a, b)
Expand Down

0 comments on commit 4105af8

Please sign in to comment.