1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-09-22 20:50:17 +02:00

Fix rare crash with warps (when player:getpos returns nil)

This commit is contained in:
LeMagnesium 2015-08-29 11:42:15 +02:00
parent 5f1aa7a47b
commit 2aab854a4f

View File

@ -147,6 +147,9 @@ minetest.register_chatcommand("setwarp", {
end
local player = minetest.get_player_by_name(name)
local pos = player:getpos()
if not pos then
return false, "Internal error while getting your position. Please try again later"
end
table.insert(warps, { name = param, x = pos.x, y = pos.y, z = pos.z, yaw = player:get_look_yaw(), pitch = player:get_look_pitch() })
save()
minetest.log("action", name .. " " .. h .. " warp \"" .. param .. "\": " .. pos.x .. ", " .. pos.y .. ", " .. pos.z)