changeset 111:9f8994d82fd1

Fixed attempt to access a nil NPC entry.
author James D. Callahan III <jcallahan@curse.com>
date Fri, 07 Sep 2012 05:37:28 -0500
parents 28bff1138694
children 5ed405092296
files Main.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Thu Sep 06 14:32:14 2012 -0500
+++ b/Main.lua	Fri Sep 07 05:37:28 2012 -0500
@@ -268,8 +268,13 @@
     local COORD_MAX = 5
 
     function UpdateNPCLocation(unit_idnum)
+        local npc = NPCEntry(unit_idnum)
+
+        if not npc then
+            return
+        end
         local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData()
-        local npc_data = NPCEntry(unit_idnum).encounter_data[difficulty_token].stats[("level_%d"):format(_G.UnitLevel("target"))]
+        local npc_data = npc.encounter_data[difficulty_token].stats[("level_%d"):format(_G.UnitLevel("target"))]
         local zone_token = ("%s:%d"):format(zone_name, area_id)
         npc_data.locations = npc_data.locations or {}