changeset 191:5346ba9b6419 1.0.26

Check for nil item string before attempting to get an upgrade ID.
author James D. Callahan III <jcallahan@curse.com>
date Wed, 21 Nov 2012 11:39:08 -0600
parents 936e2c9a4633
children 114244417fc7
files Main.lua
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Mon Nov 19 09:16:13 2012 -0600
+++ b/Main.lua	Wed Nov 21 11:39:08 2012 -0600
@@ -811,10 +811,14 @@
         return
     end
     local item = DBEntry("items", item_id)
-    local _, _, _, _, _, _, _, _, _, _, _, upgrade_id = (":"):split(select(3, item_link:find("^|%x+|H(.+)|h%[.+%]")))
+    local item_string = select(3, item_link:find("^|%x+|H(.+)|h%[.+%]"))
 
-    if upgrade_id then
-        DBEntry("items", item_id).upgrade_id = upgrade_id
+    if item_string then
+        local _, _, _, _, _, _, _, _, _, _, _, upgrade_id = (":"):split(item_string)
+
+        if upgrade_id then
+            item.upgrade_id = upgrade_id
+        end
     end
     item.durability = durability
 end