debuffs: fix tons of nil errors

This commit is contained in:
shagu
2018-04-05 20:42:18 +02:00
parent fa4048b56e
commit 2196999a44
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -170,7 +170,7 @@ pfUI:RegisterModule("debuffs", function ()
function pfUI.debuffs:GetMaxRank(effect)
local max = 0
for id in pairs(effect) do
for id in pairs(L["debuffs"][effect]) do
if id > max then max = id end
end
return max
@@ -183,10 +183,11 @@ pfUI:RegisterModule("debuffs", function ()
if not pfUI.debuffs.objects[unit][unitlevel] then pfUI.debuffs.objects[unit][unitlevel] = {} end
if not pfUI.debuffs.objects[unit][unitlevel][effect] then pfUI.debuffs.objects[unit][unitlevel][effect] = {} end
pfUI.debuffs.objects[unit][unitlevel][effect].old = {}
pfUI.debuffs.objects[unit][unitlevel][effect].start = GetTime()
pfUI.debuffs.objects[unit][unitlevel][effect].duration = duration or pfUI.debuffs:GetDuration(effect)
pfUI.debuffs.pending = {}
if pfUI.uf.target then
pfUI.uf:RefreshUnit(pfUI.uf.target, "aura")
end
@@ -207,7 +208,7 @@ pfUI:RegisterModule("debuffs", function ()
if pfUI.debuffs.objects[unitname] and pfUI.debuffs.objects[unitname][unitlevel] and pfUI.debuffs.objects[unitname][unitlevel][effect] then
-- clean up db
if pfUI.debuffs.objects[unitname][unitlevel][effect].duration + pfUI.debuffs.objects[unitname][unitlevel][effect].start < GetTime() then
if pfUI.debuffs.objects[unitname][unitlevel][effect].duration and pfUI.debuffs.objects[unitname][unitlevel][effect].duration + pfUI.debuffs.objects[unitname][unitlevel][effect].start < GetTime() then
pfUI.debuffs.objects[unitname][unitlevel][effect] = nil
return 0, 0, 0
end
@@ -220,7 +221,7 @@ pfUI:RegisterModule("debuffs", function ()
-- no level data
elseif pfUI.debuffs.objects[unitname] and pfUI.debuffs.objects[unitname][0] and pfUI.debuffs.objects[unitname][0][effect] then
-- clean up db
if pfUI.debuffs.objects[unitname][0][effect].duration + pfUI.debuffs.objects[unitname][0][effect].start < GetTime() then
if pfUI.debuffs.objects[unitname][0][effect].duration and pfUI.debuffs.objects[unitname][0][effect].duration + pfUI.debuffs.objects[unitname][0][effect].start < GetTime() then
pfUI.debuffs.objects[unitname][0][effect] = nil
return 0, 0, 0
end
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: |cff33ffccpf|cffffffffUI
## Author: Shagu
## Notes: A complete user interface replacement.
## Version: 3.8.2
## Version: 3.8.3
## SavedVariables: pfUI_profiles, pfUI_gold
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB