summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-06-19 18:42:13 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2018-06-19 18:42:13 +0100
commit10abb996c10c310f8cea66e7e085b852897a0a23 (patch)
tree8bc6711e3be2c12c9f5f821b9cb8d1fe2dbfe3f2
parent1018a558d2b92eb5cdba657c0f6367243c1b85a8 (diff)
nil check
-rw-r--r--crops/beans.lua2
-rw-r--r--crops/cocoa.lua2
-rw-r--r--crops/grapes.lua2
-rw-r--r--init.lua2
4 files changed, 4 insertions, 4 deletions
diff --git a/crops/beans.lua b/crops/beans.lua
index 61b195b..a575956 100644
--- a/crops/beans.lua
+++ b/crops/beans.lua
@@ -32,7 +32,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
end
-- is player planting crop?
- local name = placer:get_player_name() or ""
+ local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
diff --git a/crops/cocoa.lua b/crops/cocoa.lua
index 8424db4..19e9c6b 100644
--- a/crops/cocoa.lua
+++ b/crops/cocoa.lua
@@ -32,7 +32,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
end
-- is player planting crop?
- local name = placer:get_player_name() or ""
+ local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.above, name) then
diff --git a/crops/grapes.lua b/crops/grapes.lua
index 8781ece..d8c6c3f 100644
--- a/crops/grapes.lua
+++ b/crops/grapes.lua
@@ -27,7 +27,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
end
-- is player planting seed?
- local name = placer:get_player_name() or ""
+ local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
diff --git a/init.lua b/init.lua
index 4f5f2be..038ba6d 100644
--- a/init.lua
+++ b/init.lua
@@ -445,7 +445,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
end
-- is player planting seed?
- local name = placer:get_player_name() or ""
+ local name = placer and placer:get_player_name() or ""
-- if not protected then add node and remove 1 item from the itemstack
if not minetest.is_protected(pt.above, name) then