Quantcast

Fixed two config related bugs with auras module.

Daniel Yates [02-18-11 - 01:02]
Fixed two config related bugs with auras module.
Filename
Modules/Auras.lua
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