From 94d87a9e92f7470347aaf4ea6c467eed4f9b58a8 Mon Sep 17 00:00:00 2001 From: kaadmy Date: Wed, 2 Dec 2015 12:26:23 -0800 Subject: [PATCH] trying to make navigation maps more crash-tolerant --- mods/nav/map.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/nav/map.lua b/mods/nav/map.lua index 67a0846..b9869de 100644 --- a/mods/nav/map.lua +++ b/mods/nav/map.lua @@ -53,7 +53,10 @@ local function get_formspec_waypoint(x, y, name, label, isinfo) end function nav.show_map(player) + if player == nil then return end + local name = player:get_player_name() + if not open_formspecs[name] then return end local pos = player:getpos() @@ -117,11 +120,13 @@ local function step(dtime) local players = {} for _, player in pairs(minetest.get_connected_players()) do - local name = player:get_player_name() - - players[name] = player - - nav.show_map(player) + if player ~= nil then + local name = player:get_player_name() + + players[name] = player + + nav.show_map(player) + end end for wptname, wpt in pairs(nav.waypoints) do