From: paramat Date: Wed, 21 Dec 2016 07:38:27 +0000 (+0000) Subject: Boats: Avoid crash if boat pos over limit X-Git-Tag: 0.4.15^0 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3c9d0893ee82cf1d68fa7366e14435ea5009fa51;p=oweals%2Fminetest_game.git Boats: Avoid crash if boat pos over limit If the boat pos is over limit, 'add entity' will not add an entity, causing 'boat' to be nil. --- diff --git a/mods/boats/init.lua b/mods/boats/init.lua index 9f1264b1..0591ef24 100644 --- a/mods/boats/init.lua +++ b/mods/boats/init.lua @@ -233,9 +233,11 @@ minetest.register_craftitem("boats:boat", { end pointed_thing.under.y = pointed_thing.under.y + 0.5 boat = minetest.add_entity(pointed_thing.under, "boats:boat") - boat:setyaw(placer:get_look_horizontal()) - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() + if boat then + boat:setyaw(placer:get_look_horizontal()) + if not minetest.setting_getbool("creative_mode") then + itemstack:take_item() + end end return itemstack end,