summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2017-11-15 18:04:09 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2017-11-15 18:04:09 +0100
commit5e4aa0f3567f0daa2be0a6f6ec013f812201383b (patch)
tree7463485e90d2494196f55900e7cfc7ba771a19dd
parentb746dc91d374d079aec8507a8501c9fc7fdf486d (diff)
downloadsmartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.tar.gz
smartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.tar.bz2
smartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.zip
Fixed crash with unknown objects
-rw-r--r--init.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 0969ead..8eb1348 100644
--- a/init.lua
+++ b/init.lua
@@ -176,9 +176,13 @@ smartshop.update_info=function(pos)
--if string.find(stuff["name" ..i],":")~=nil then
-- stuff["name" ..i]=stuff["name" ..i].split(stuff["name" ..i],":")[2]
--end
- stuff["name"..i] = core.registered_items[stuff["name"..i]].description
- stuff["buy" ..i]="(" ..stuff["buy" ..i] ..") "
- stuff["name" ..i]=stuff["name" ..i] .."\n"
+ if core.registered_items[stuff["name"..i]] then
+ stuff["name"..i] = core.registered_items[stuff["name"..i]].description
+ else
+ stuff["name"..i] = "Unknown Object"
+ end
+ stuff["buy" ..i]="(" ..stuff["buy" ..i] ..") "
+ stuff["name" ..i]=stuff["name" ..i] .."\n"
end
end
meta:set_string("infotext",