Doors: Fix trapdoor crash on can_dig with nil-player (e.g. minetest.dig_node)
authorTim <t4im@users.noreply.github.com>
Thu, 7 Jul 2016 22:51:54 +0000 (00:51 +0200)
committerparamat <mat.gregory@virginmedia.com>
Sun, 10 Jul 2016 20:07:17 +0000 (21:07 +0100)
mods/doors/init.lua

index ae41f2ddebc325efd421e6ba155f3d6ce84f4786..0f72a321de0c89d1551c24febef897bd691a6ded 100644 (file)
@@ -543,8 +543,8 @@ function doors.register_trapdoor(name, def)
                        return true
                end
                local meta = minetest.get_meta(pos)
-               local pn = player:get_player_name()
-               return meta:get_string("doors_owner") == pn
+               local player_name = player and player:get_player_name()
+               return meta:get_string("doors_owner") == player_name
        end
 
        def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)