Quantcast

Add some error checking to make sure the profession isn't nil

ackis [01-15-09 - 18:13]
Add some error checking to make sure the profession isn't nil
Filename
.docmeta
AckisRecipeList.lua
diff --git a/.docmeta b/.docmeta
index a28907c..fed27ab 100644
--- a/.docmeta
+++ b/.docmeta
@@ -4,4 +4,8 @@ output-page: "Database Documentation"

 type: wiki
 input-file: Docs/Main.txt
-output-page: "Main"
\ No newline at end of file
+output-page: "Main"
+
+type: luadoc
+input-file: AckisRecipeList.lua
+output-page: "API"
\ No newline at end of file
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index 5f8fb6c..cba6ba7 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -1326,13 +1326,16 @@ local function InitializeRecipes(RecipeDB, playerProfession)
 		[GetSpellInfo(53428)] = addon.InitRuneforging,
 	}

-	-- Thanks to sylvanaar/xinhuan for the code snippet
-	local a = professiontable[playerProfession]
+	-- Check for player profession to fix some bugs with addons that interface with ARL
+	if (playerProfession) then
+		-- Thanks to sylvanaar/xinhuan for the code snippet
+		local a = professiontable[playerProfession]

-	if a then
-		return a(addon, RecipeDB)
-	else
-		addon:Print(L["UnknownTradeSkill"]:format(playerProfession))
+		if a then
+			return a(addon, RecipeDB)
+		else
+			addon:Print(L["UnknownTradeSkill"]:format(playerProfession))
+		end
 	end

 end