From 394aa05c6c4997888ea73a69715988b538d3bd29 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Wed, 21 May 2014 13:07:34 +0000 Subject: [PATCH] Guard against removing auras that aren't in the aura database. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1476 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 72 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index a6dbe98..c4c822b 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -477,45 +477,47 @@ end function OvaleAura:LostAuraOnGUID(guid, atTime, auraId, casterGUID) local aura = GetAura(self.aura, guid, auraId, casterGUID) - local filter = aura.filter - Ovale:DebugPrintf(OVALE_AURA_DEBUG, " Expiring %s %s (%d) from %s at %f.", - filter, aura.name, auraId, guid, atTime) - if aura.ending > atTime then - aura.ending = atTime - end + if aura then + local filter = aura.filter + Ovale:DebugPrintf(OVALE_AURA_DEBUG, " Expiring %s %s (%d) from %s at %f.", + filter, aura.name, auraId, guid, atTime) + if aura.ending > atTime then + aura.ending = atTime + end - local mine = (casterGUID == self_guid) - if mine then - -- Clear old tick information for player-applied periodic auras. - aura.tick = nil - aura.ticksSeen = nil - aura.lastTickTime = nil - - -- Check if the aura was consumed by the last spellcast. - -- The aura must have ended early, i.e., start + duration > ending. - if aura.start + aura.duration > aura.ending then - local spellcast - if guid == self_guid then - -- Player aura, so it was possibly consumed by an in-flight spell. - spellcast = OvaleFuture:LastInFlightSpell() - else - -- Non-player aura, so it was possibly consumed by a spell that landed on its target. - spellcast = OvaleFuture.lastSpellcast - end - if spellcast and spellcast.stop and IsWithinAuraLag(spellcast.stop, aura.ending) then - aura.consumed = true - local spellName = OvaleSpellBook:GetSpellName(spellcast.spellId) or "Unknown spell" - Ovale:DebugPrintf(OVALE_AURA_DEBUG, " Consuming %s %s (%d) on %s with %s (%d) at %f.", - filter, aura.name, auraId, guid, spellName, spellcast.spellId, spellcast.stop) + local mine = (casterGUID == self_guid) + if mine then + -- Clear old tick information for player-applied periodic auras. + aura.tick = nil + aura.ticksSeen = nil + aura.lastTickTime = nil + + -- Check if the aura was consumed by the last spellcast. + -- The aura must have ended early, i.e., start + duration > ending. + if aura.start + aura.duration > aura.ending then + local spellcast + if guid == self_guid then + -- Player aura, so it was possibly consumed by an in-flight spell. + spellcast = OvaleFuture:LastInFlightSpell() + else + -- Non-player aura, so it was possibly consumed by a spell that landed on its target. + spellcast = OvaleFuture.lastSpellcast + end + if spellcast and spellcast.stop and IsWithinAuraLag(spellcast.stop, aura.ending) then + aura.consumed = true + local spellName = OvaleSpellBook:GetSpellName(spellcast.spellId) or "Unknown spell" + Ovale:DebugPrintf(OVALE_AURA_DEBUG, " Consuming %s %s (%d) on %s with %s (%d) at %f.", + filter, aura.name, auraId, guid, spellName, spellcast.spellId, spellcast.stop) + end end end - end - aura.lastUpdated = atTime + aura.lastUpdated = atTime - self:SendMessage("Ovale_AuraRemoved", atTime, guid, auraId, aura.source) - local unitId = OvaleGUID:GetUnitId(guid) - if unitId then - Ovale.refreshNeeded[unitId] = true + self:SendMessage("Ovale_AuraRemoved", atTime, guid, auraId, aura.source) + local unitId = OvaleGUID:GetUnitId(guid) + if unitId then + Ovale.refreshNeeded[unitId] = true + end end end -- 1.7.9.5