From 2aab854a4f23b8a9ec511a3029c76505eb7b6044 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Sat, 29 Aug 2015 11:42:15 +0200 Subject: [PATCH] Fix rare crash with warps (when player:getpos returns nil) --- mods/warps/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mods/warps/init.lua b/mods/warps/init.lua index 259e75a9..b5d928f9 100755 --- a/mods/warps/init.lua +++ b/mods/warps/init.lua @@ -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)