From d780097a4881bbbbdf3c573582529195142ae5b8 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Wed, 2 Oct 2019 19:13:55 +0100 Subject: [PATCH] add some nil checks for itemstack when right clicking on_rightclick nodes --- crops/beans.lua | 2 +- crops/cocoa.lua | 2 +- crops/grapes.lua | 2 +- init.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crops/beans.lua b/crops/beans.lua index d02cff5..5017248 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -27,7 +27,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end diff --git a/crops/cocoa.lua b/crops/cocoa.lua index fc044e4..3f54a89 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -21,7 +21,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end diff --git a/crops/grapes.lua b/crops/grapes.lua index af57345..a41bb88 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -22,7 +22,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end diff --git a/init.lua b/init.lua index 77e43ff..0769709 100644 --- a/init.lua +++ b/init.lua @@ -421,7 +421,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end