From 7e914caa59dfb97d3ce7cb326c1fc3c254ccc742 Mon Sep 17 00:00:00 2001 From: Louis <55180044+louisroyer@users.noreply.github.com> Date: Wed, 19 Aug 2020 15:12:08 +0200 Subject: [PATCH] Fix crash when using hoe but not on a node Fix #9. --- hoe.lua | 4 ++++ init.lua | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hoe.lua b/hoe.lua index cd49cd6..cc69501 100644 --- a/hoe.lua +++ b/hoe.lua @@ -14,6 +14,10 @@ local function add_hoe(material) minetest.override_item(name, { -- we also want hoes to increase dugnodes when farming soil on_use = function(itemstack, user, pointed_thing, uses) + -- if no node is pointed, the hoe cannot be used + if pointed_thing.under == nil then + return nil + end local under = minetest.get_node(pointed_thing.under) -- get origin wear local wear = itemstack:get_wear() diff --git a/init.lua b/init.lua index 375135f..037084d 100644 --- a/init.lua +++ b/init.lua @@ -3,7 +3,7 @@ local MP = minetest.get_modpath("toolranks_extras") toolranks_extras = {} -- mod information -toolranks_extras.mod = {version = "1.4.1", author = "Louis Royer"} +toolranks_extras.mod = {version = "1.4.2", author = "Louis Royer"} -- settings toolranks_extras.settings = {