Mercurial > wow > wowdb-profiler
comparison Main.lua @ 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 | ab41dfac7ca9 |
children | 5ed405092296 |
comparison
equal
deleted
inserted
replaced
110:28bff1138694 | 111:9f8994d82fd1 |
---|---|
266 local UpdateNPCLocation | 266 local UpdateNPCLocation |
267 do | 267 do |
268 local COORD_MAX = 5 | 268 local COORD_MAX = 5 |
269 | 269 |
270 function UpdateNPCLocation(unit_idnum) | 270 function UpdateNPCLocation(unit_idnum) |
271 local npc = NPCEntry(unit_idnum) | |
272 | |
273 if not npc then | |
274 return | |
275 end | |
271 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() | 276 local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData() |
272 local npc_data = NPCEntry(unit_idnum).encounter_data[difficulty_token].stats[("level_%d"):format(_G.UnitLevel("target"))] | 277 local npc_data = npc.encounter_data[difficulty_token].stats[("level_%d"):format(_G.UnitLevel("target"))] |
273 local zone_token = ("%s:%d"):format(zone_name, area_id) | 278 local zone_token = ("%s:%d"):format(zone_name, area_id) |
274 npc_data.locations = npc_data.locations or {} | 279 npc_data.locations = npc_data.locations or {} |
275 | 280 |
276 local zone_data = npc_data.locations[zone_token] | 281 local zone_data = npc_data.locations[zone_token] |
277 | 282 |