Missing nil check in TargetInvuln.lua
kanegasi opened this issue ยท 0 comments
Swatter error that shows up on load
Date: 2022-03-25 21:44:42
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\IceHUD\modules\TargetInvuln.lua line 203:
attempt to perform arithmetic on field 'lastUpdateTime' (a nil value)
Debug:
[string "@IceHUD\modules\TargetInvuln.lua"]:203: ?()
[string "@AccountWideRaidProfiles\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"]:119:
...les\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:119
[string "=[C]"]: ?
[string "@AccountWideRaidProfiles\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"]:29:
...les\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:25
[string "@AccountWideRaidProfiles\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua"]:64: Fire()
[string "@AccountWideRaidProfiles\Libs\AceEvent-3.0\AceEvent-3.0.lua"]:120:
...tWideRaidProfiles\Libs\AceEvent-3.0\AceEvent-3.0.lua:119
Locals:
None
TargetCC.lua nil check
function TargetCC.prototype:UpdateTargetDebuffs(event, unit, isUpdate)
local name, duration, remaining
if not isUpdate or not self.lastUpdateTime then -- nil check
self.debuffName, self.debuffDuration, self.debuffRemaining = self:GetMaxDebuffDuration(self.unit, self.debuffList)
else
self.debuffRemaining = math.max(0, self.debuffRemaining - (GetTime() - self.lastUpdateTime))
if self.debuffRemaining <= 0 then
self.debuffName = nil
end
end
self.lastUpdateTime = GetTime()
What you have in TargetInvuln.lua
function TargetInvuln.prototype:UpdateTargetBuffs(event, unit, isUpdate)
local name, duration, remaining
if not isUpdate then -- missing "not self.lastUpdateTime"
self.buffName, self.buffDuration, self.buffRemaining = self:GetMaxbuffDuration(self.unit, self.buffList)
else
self.buffRemaining = math.max(0, self.buffRemaining - (GetTime() - self.lastUpdateTime))
if self.buffRemaining <= 0 then
self.buffName = nil
end
end
self.lastUpdateTime = GetTime()