diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-11-15 18:04:09 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2017-11-15 18:04:09 +0100 |
commit | 5e4aa0f3567f0daa2be0a6f6ec013f812201383b (patch) | |
tree | 7463485e90d2494196f55900e7cfc7ba771a19dd | |
parent | b746dc91d374d079aec8507a8501c9fc7fdf486d (diff) | |
download | smartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.tar.gz smartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.tar.bz2 smartshop-5e4aa0f3567f0daa2be0a6f6ec013f812201383b.zip |
Fixed crash with unknown objects
-rw-r--r-- | init.lua | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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",
|