Skip to content

Commit 9050854

Browse files
committed
More guards for GetPlayerInfoByGUID
1 parent 573d76e commit 9050854

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

Code/CombatEvents.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,13 +2312,14 @@ local function checkForRelevance(sourceFlags, destFlags)
23122312
bit_band(destFlags, FLAGS_RELEVANT) == FLAGS_RELEVANT
23132313
end
23142314

2315-
function module:HandleCombatlogEvent(uid, timestamp, eventType, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
2315+
function module:HandleCombatlogEvent(uid, timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
23162316
if not self:IsEnabled() then return end -- TODO remove
23172317

23182318
if checkForRelevance(sourceFlags, destFlags) then
23192319
local registeredHandlers = combatLogEvents[eventType]
23202320
if registeredHandlers then
23212321
local info = newList()
2322+
info.hideCaster = hideCaster
23222323
info.sourceID = sourceGUID
23232324
info.sourceName = sourceName or ""
23242325
info.sourceFlags = sourceFlags

Data/CombatEvents.lua

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,38 +127,42 @@ end
127127
-- functions to retrieve player-names (to hide realm-names)
128128
--]]
129129
local function retrieveSourceName(info)
130-
if db.hideUnitNames or info.sourceName == "" or not info.sourceID then
130+
if db.hideUnitNames or info.sourceName == "" or info.hideCaster then
131131
return "__NONAME__"
132132
end
133133

134-
local _, class, _, _, _, name = GetPlayerInfoByGUID(info.sourceID)
135-
if class then
136-
if not db.hideRealm then
137-
name = info.sourceName
134+
if info.sourceID and info.sourceID ~= "" then
135+
local _, class, _, _, _, name = GetPlayerInfoByGUID(info.sourceID)
136+
if class then
137+
if not db.hideRealm then
138+
name = info.sourceName
139+
end
140+
if db.classcolor then
141+
name = classColorStrings[class]:format(name)
142+
end
143+
return name
138144
end
139-
if db.classcolor then
140-
name = classColorStrings[class]:format(name)
141-
end
142-
return name
143145
end
144146

145147
return info.sourceName
146148
end
147149

148150
local function retrieveDestName(info)
149-
if db.hideUnitNames or info.recipientName == "" or not info.recipientID then
151+
if db.hideUnitNames or info.recipientName == "" or info.hideCaster then
150152
return "__NONAME__"
151153
end
152154

153-
local _, class, _, _, _, name = GetPlayerInfoByGUID(info.recipientID)
154-
if class then
155-
if not db.hideRealm then
156-
name = info.recipientName
157-
end
158-
if db.classcolor then
159-
name = classColorStrings[class]:format(name)
155+
if info.recipientID and info.recipientID ~= "" then
156+
local _, class, _, _, _, name = GetPlayerInfoByGUID(info.recipientID)
157+
if class then
158+
if not db.hideRealm then
159+
name = info.recipientName
160+
end
161+
if db.classcolor then
162+
name = classColorStrings[class]:format(name)
163+
end
164+
return name
160165
end
161-
return name
162166
end
163167

164168
return info.recipientName

0 commit comments

Comments
 (0)