From acc46dcb418e363baa0da4183cba1252409b73db Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Fri, 18 Feb 2011 01:02:24 +0000 Subject: [PATCH] Fixed two config related bugs with auras module. --- Modules/Auras.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Modules/Auras.lua b/Modules/Auras.lua index d4c82ba..f66286b 100644 --- a/Modules/Auras.lua +++ b/Modules/Auras.lua @@ -104,23 +104,25 @@ function ModuleFrame:CalculateActionTable() local actions, key; for auraID=1,360 do -- Reset vars. - actions, key = nil, nil; - -- Get the actions. - actions = ModuleFrame:GetAuraActions(auraID); + actions, key = ModuleFrame:GetAuraActions(auraID), nil; if(actions and #(actions) > 0) then -- Go over them. for actionID, actionData in pairs(actions) do -- Calculate a key from the data. - key = strupper(strsub(actionData["type"], 0, 1)) .. actionData["id"]; - -- Does a table for auras with this key already exist? - if(not ActionTable[key]) then - ActionTable[key] = {}; + if(actionData and actionData["id"] and actionData["id"] > 0) then + key = strupper(strsub(actionData["type"], 0, 1)) .. actionData["id"]; + -- Does a table for auras with this key already exist? + if(not ActionTable[key]) then + ActionTable[key] = {}; + end + -- Add the aura. + tinsert(ActionTable[key], format("%03d", auraID) .. actionID); end - -- Add the aura. - tinsert(ActionTable[key], format("%03d", auraID) .. actionID); end end end + -- Perform GC. + collectgarbage("collect"); end --[[ ---------------------------------------------------------------------------------------------------- @@ -247,6 +249,7 @@ Merges two action data tables, toggling off switches to on. --]] function ModuleFrame:MergeAuraAction(actionTable, actionData) -- Go over the data table. + if(not actionData) then return actionTable; end for key, value in pairs(actionData) do -- If the key is any of ours (type/id), ignore. if(key ~= "type" and key ~= "id") then -- 1.7.9.5