Quantcast

Fixed: More error check in CountPerson method

Taracque [03-08-13 - 07:11]
Fixed: More error check in CountPerson method
Filename
Change_log.txt
Elementarist.lua
Elementarist.toc
diff --git a/Change_log.txt b/Change_log.txt
index 8bbaf9e..6c8f30f 100755
--- a/Change_log.txt
+++ b/Change_log.txt
@@ -1,3 +1,6 @@
+**v3.1.5**
+* Fixed: More error check in CountPerson method
+
 **v3.1.4**
 * Fixed: LUA error in CountPerson method

diff --git a/Elementarist.lua b/Elementarist.lua
index 6718e6e..990e7c9 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -1,5 +1,5 @@
 -------------------------------------------------------------------------------
--- Elementarist 3.1.4
+-- Elementarist 3.1.5
 --
 -- Shows the advised spell for an elemental shaman for optimal DPS output.
 -------------------------------------------------------------------------------
@@ -8,7 +8,7 @@ Elementarist = {Locals = {}}

 local L = Elementarist.Locals

-Elementarist.versionNumber = '3.1.4';
+Elementarist.versionNumber = '3.1.5';
 Elementarist.enabled = true;
 Elementarist.playerName = UnitName("player")
 Elementarist.playerGUID = UnitGUID("player")
@@ -390,8 +390,15 @@ end
 function Elementarist:CountPerson(time, event, sguid, sname, sflags, dguid, dname, dflags)
 	local suffix = event:match(".+(_.-)$")
 	if Elementarist.HostileFilter[suffix] then
-		local stype = (tonumber(sguid:sub(5,5), 16)) % 8
-		local dtype = (tonumber(dguid:sub(5,5), 16)) % 8
+		local stype = 0;
+		local dtype = 0;
+
+		if (sguid) then
+			stype = (tonumber(sguid:sub(5,5), 16)) % 8;
+		end
+		if (dguid) then
+			dtype = (tonumber(dguid:sub(5,5), 16)) % 8;
+		end
 		if (bit.band(dflags, COMBATLOG_OBJECT_REACTION_HOSTILE) == COMBATLOG_OBJECT_REACTION_HOSTILE) and (bit.band(dflags, COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) == COMBATLOG_OBJECT_AFFILIATION_OUTSIDER) and ((dtype==0) or (dtype==3)) then
 			if ((not Elementarist.person["foe"][dguid]) or (Elementarist.person["foe"][dguid]==0)) then
 				Elementarist.person["foeCount"] = Elementarist.person["foeCount"] + 1
diff --git a/Elementarist.toc b/Elementarist.toc
index 60d9f2a..d40ae2f 100755
--- a/Elementarist.toc
+++ b/Elementarist.toc
@@ -2,7 +2,7 @@
 ## Title: Elementarist
 ## Notes: Elemental shaman spell rotation helper
 ## Author: Taracque, Felmosórongy of Arathor
-## Version: 3.1.4
+## Version: 3.1.5
 ## SavedVariables: ElementaristDB
 ## OptionalDeps: OmniCC, SpellFlash
 ## Dependencies: