From 1fd279435c391736ece2893fefd47c1497727770 Mon Sep 17 00:00:00 2001 From: Niklp <89982526+Niklp09@users.noreply.github.com> Date: Fri, 10 Mar 2023 21:30:49 +0100 Subject: [PATCH] fix crash due nil itemstack (#13) * fix crashes due nil itemstacks --- home_vending_machines/api.lua | 1 + home_workshop_misc/init.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/home_vending_machines/api.lua b/home_vending_machines/api.lua index ccad0bf..244b73f 100644 --- a/home_vending_machines/api.lua +++ b/home_vending_machines/api.lua @@ -28,6 +28,7 @@ local function reg_simple(name, def) end end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if not itemstack then return end local pname = clicker:get_player_name() local iname = itemstack:get_name() local dpos = vector.add((vector.multiply(minetest.facedir_to_dir(node.param2), -1)), pos) diff --git a/home_workshop_misc/init.lua b/home_workshop_misc/init.lua index 71be024..7aab0c8 100644 --- a/home_workshop_misc/init.lua +++ b/home_workshop_misc/init.lua @@ -44,6 +44,7 @@ minetest.register_node("home_workshop_misc:beer_tap", { }, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) local inv = clicker:get_inventory() + if not itemstack then return end local wieldname = itemstack:get_name() if wieldname == "vessels:drinking_glass" then