changeset 227:3dd05b29bc6f 1.0.38

Make sure the NPC entry is non-nil before attempting to set its metatable.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 29 Jan 2013 17:45:24 -0600
parents 7471bca69c99
children 6c78c5c7aee4
files Main.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Mon Jan 28 18:36:39 2013 -0600
+++ b/Main.lua	Tue Jan 29 17:45:24 2013 -0600
@@ -333,12 +333,12 @@
     }
 
     function NPCEntry(identifier)
-        local npc = _G.setmetatable(DBEntry("npcs", identifier), npc_meta)
+        local npc = DBEntry("npcs", identifier)
 
         if not npc then
             return
         end
-        return npc
+        return _G.setmetatable(npc, npc_meta)
     end
 
     function npc_prototype:EncounterData()