From 5e4aa0f3567f0daa2be0a6f6ec013f812201383b Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Wed, 15 Nov 2017 18:04:09 +0100 Subject: Fixed crash with unknown objects --- init.lua | 10 +++++++--- 1 file 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", -- cgit v1.2.3