check for "is_player()" on "on_use"

fixes https://github.com/pandorabox-io/pandorabox.io/issues/547
This commit is contained in:
Buckaroo Banzai 2020-10-05 07:00:23 +02:00 committed by GitHub
parent a814fbe160
commit d6af7437b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,7 +328,8 @@ minetest.register_tool("hangglider:hangglider", {
inventory_image = "glider_item.png", inventory_image = "glider_item.png",
stack_max=1, stack_max=1,
on_use = function(itemstack, player) on_use = function(itemstack, player)
if not player then if not player or (player.is_player and not player:is_player()) then
-- player does not exist or is created from an autometed machine (fake_player)
return return
end end
local pos = player:get_pos() local pos = player:get_pos()