Quantcast

Added more safechecks. this fixes #292

Darthpred [08-21-16 - 14:27]
Added more safechecks. this fixes #292
Filename
ElvUI_SLE/modules/sledatatexts/guild.lua
diff --git a/ElvUI_SLE/modules/sledatatexts/guild.lua b/ElvUI_SLE/modules/sledatatexts/guild.lua
index d84438b..adaac80 100644
--- a/ElvUI_SLE/modules/sledatatexts/guild.lua
+++ b/ElvUI_SLE/modules/sledatatexts/guild.lua
@@ -48,10 +48,13 @@ ssRegFont:SetFont(GameTooltipText:GetFont(), 12)

 local list_sort = {
 	TOONNAME = function(a, b)
+		if not a["TOONNAME"] or not b["TOONNAME"] then return false end
 		return a["TOONNAME"] < b["TOONNAME"]
 	end,
 	LEVEL =	function(a, b)
-		if a["LEVEL"] < b["LEVEL"] then
+		if not a["LEVEL"] or not b["LEVEL"] then
+			return false
+		elseif a["LEVEL"] < b["LEVEL"] then
 			return true
 		elseif a["LEVEL"] > b["LEVEL"] then
 			return false
@@ -60,7 +63,9 @@ local list_sort = {
 		end
 	end,
 	RANKINDEX =	function(a, b)
-		if a["RANKINDEX"] > b["RANKINDEX"] then
+		if not a["RANKINDEX"] or not b["RANKINDEX"] then
+			return false
+		elseif a["RANKINDEX"] > b["RANKINDEX"] then
 			return true
 		elseif a["RANKINDEX"] < b["RANKINDEX"] then
 			return false
@@ -80,10 +85,13 @@ local list_sort = {
 		end
 	end,
 	revTOONNAME	= function(a, b)
+		if a["TOONNAME"] or not b["TOONNAME"] then return false end
 		return a["TOONNAME"] > b["TOONNAME"]
 	end,
 	revLEVEL = function(a, b)
-		if a["LEVEL"] > b["LEVEL"] then
+		if not a["LEVEL"] or not b["LEVEL"] then
+			return false
+		elseif a["LEVEL"] > b["LEVEL"] then
 			return true
 		elseif a["LEVEL"] < b["LEVEL"] then
 			return false
@@ -92,7 +100,9 @@ local list_sort = {
 		end
 	end,
 	revRANKINDEX = function(a, b)
-		if a["RANKINDEX"] < b["RANKINDEX"] then
+		if not a["RANKINDEX"] or not b["RANKINDEX"] then
+			return false
+		elseif a["RANKINDEX"] < b["RANKINDEX"] then
 			return true
 		elseif a["RANKINDEX"] > b["RANKINDEX"] then
 			return false
@@ -101,7 +111,9 @@ local list_sort = {
 		end
 	end,
 	revZONENAME	= function(a, b)
-		if a["ZONENAME"] > b["ZONENAME"] then
+		if not a["ZONENAME"] or not b["ZONENAME"] then
+			return false
+		elseif a["ZONENAME"] > b["ZONENAME"] then
 			return true
 		elseif a["ZONENAME"] < b["ZONENAME"] then
 			return false