From 3d36d4eb7e0fbf89b91860c9936a1b6c89a4deba Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Fri, 8 Feb 2019 23:59:53 -0500 Subject: [PATCH] Fix a crash on running out of hints. --- mods/nc_guide/init.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mods/nc_guide/init.lua b/mods/nc_guide/init.lua index 3c1580d4..383d1cfe 100644 --- a/mods/nc_guide/init.lua +++ b/mods/nc_guide/init.lua @@ -205,15 +205,15 @@ local function sethint(player) found[#found + 1] = hint.text end end - found = nodecore.pickrand(found) - if not found then - player:set_inventory_formspec(nodecore.inventory_formspec) - end - - return player:set_inventory_formspec(nodecore.inventory_formspec - .. "label[0,3.1;...have you " - .. minetest.formspec_escape(found) - .. " yet...?") + local hint = nodecore.pickrand(found) + if hint then + return player:set_inventory_formspec(nodecore.inventory_formspec + .. "label[0,3.1;...have you " + .. minetest.formspec_escape(hint) + .. " yet...?") + else + return player:set_inventory_formspec(nodecore.inventory_formspec) + end end minetest.register_on_joinplayer(function(player)