From b84ed21fac6a3e4ea0724a035bc4726560143ee7 Mon Sep 17 00:00:00 2001 From: adrido Date: Wed, 5 Aug 2015 20:28:23 +0200 Subject: [PATCH] fix crash during incorrect call of `on_dig` without 2nd 3rd argument --- functions.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/functions.lua b/functions.lua index aae04d2..2a745df 100644 --- a/functions.lua +++ b/functions.lua @@ -177,6 +177,12 @@ cannons.stand_on_rightclick = function(pos, node, player, itemstack, pointed_thi end cannons.dug = function(pos, node, digger) + if not node or not type(node)=="table" then + return + end + if not digger or not digger:is_player() then + return + end local cannons = minetest.registered_nodes[node.name].cannons if cannons and cannons.stand and cannons.cannon then --node dug node.name = cannons.stand