From be145ea22e72f749f9c99c69daeefb97b3b282af Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 28 Feb 2017 02:22:22 +0100 Subject: [PATCH] Fix crash when boat is punched by non-player --- mods/ITEMS/mcl_boats/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_boats/init.lua b/mods/ITEMS/mcl_boats/init.lua index 7469e1c65..b50e43dc6 100644 --- a/mods/ITEMS/mcl_boats/init.lua +++ b/mods/ITEMS/mcl_boats/init.lua @@ -59,13 +59,13 @@ function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d if self._driver then self._driver:set_detach() self._driver = nil - if not minetest.setting_getbool("creative_mode") then + if puncher and puncher:is_player() and (not minetest.setting_getbool("creative_mode")) then puncher:get_inventory():add_item("main", "mcl_boats:boat") end self.object:remove() else - if not minetest.setting_getbool("creative_mode") then + if puncher and puncher:is_player() and (not minetest.setting_getbool("creative_mode")) then puncher:get_inventory():add_item("main", "mcl_boats:boat") end self.object:remove()