From d090728df1cc37c4a823fb001b12316920b075ba Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 27 Oct 2016 15:36:30 +0200 Subject: [PATCH] Show error for unknown currency --- init.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 6f1481e..194d33a 100644 --- a/init.lua +++ b/init.lua @@ -30,9 +30,15 @@ if easyvend.currency == nil or minetest.registered_items[easyvend.currency] == n -- Default currency easyvend.currency = "default:gold_ingot" end -easyvend.currency_desc = minetest.registered_items[easyvend.currency].description -if easyvend.currency_desc == nil or easyvend.currency_desc == "" then - easyvend.currency_desc = easyvend.currency +if minetest.registered_items[easyvend.currency] == nil then + minetest.log("error", "[easyvend] Unknown currency item “"..tostring(easyvend.currency).."”!") + easyvend.currency = "unknown" + easyvend.currency_desc = "unknown" +else + easyvend.currency_desc = minetest.registered_items[easyvend.currency].description + if easyvend.currency_desc == nil or easyvend.currency_desc == "" then + easyvend.currency_desc = easyvend.currency + end end dofile(minetest.get_modpath("easyvend") .. "/easyvend.lua") -- 2.11.4.GIT