From aa4b0297a2e71752bc70c41c0cce54f86ccfb2d9 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 18 Mar 2024 21:23:34 +0100 Subject: [PATCH] Fixed a possible Lua error trying to figure out the deserter debuff --- .luacheckrc | 1 - Changelog.lua | 9 +++++++++ QueueTools.lua | 12 ++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index a2f1b44..59a012f 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -59,7 +59,6 @@ globals = { 'tinsert', 'UISpecialFrames', 'UnitClass', - 'UnitDebuff', 'UnitExists', 'UnitFactionGroup', 'UnitFullName', diff --git a/Changelog.lua b/Changelog.lua index cb468f0..ad51902 100644 --- a/Changelog.lua +++ b/Changelog.lua @@ -1,6 +1,15 @@ local _, Namespace = ... Namespace.Changelog = { + { + version = '10.2.6-47', + improvements = { + 'Updated TOC for 10.2.6', + }, + bugs = { + 'Fixed a possible Lua error trying to figure out the deserter debuff', + }, + }, { version = '10.2.5-46', improvements = { diff --git a/QueueTools.lua b/QueueTools.lua index 8c39a22..4452644 100644 --- a/QueueTools.lua +++ b/QueueTools.lua @@ -42,7 +42,7 @@ local CharacterPanelCloseSound = SOUNDKIT.IG_CHARACTER_INFO_CLOSE local GetNumGroupMembers = GetNumGroupMembers local GetLFGRoleUpdate = GetLFGRoleUpdate local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo -local UnitDebuff = UnitDebuff +local GetDebuffDataByIndex = C_UnitAuras.GetDebuffDataByIndex local UnitInOtherParty = UnitInOtherParty local GetBattlefieldPortExpiration = GetBattlefieldPortExpiration local GetTime = GetTime @@ -194,10 +194,14 @@ function Private.TriggerDeserterUpdate(data) return end + if not data.units.primary then + return + end + for i = 1, DEBUFF_MAX_DISPLAY do - local _, _, _, _, _, expirationTime, _, _, _, spellId = UnitDebuff(data.units.primary, i) - if spellId == SpellIds.DeserterDebuff then - data.deserterExpiry = expirationTime + local aura = GetDebuffDataByIndex(data.units.primary, i) + if aura and aura.spellId == SpellIds.DeserterDebuff then + data.deserterExpiry = aura.expirationTime return end