trying to make navigation maps more crash-tolerant

This commit is contained in:
kaadmy 2015-12-02 12:26:23 -08:00
parent f1ecaee793
commit 94d87a9e92
1 changed files with 10 additions and 5 deletions

View File

@ -53,7 +53,10 @@ local function get_formspec_waypoint(x, y, name, label, isinfo)
end end
function nav.show_map(player) function nav.show_map(player)
if player == nil then return end
local name = player:get_player_name() local name = player:get_player_name()
if not open_formspecs[name] then return end if not open_formspecs[name] then return end
local pos = player:getpos() local pos = player:getpos()
@ -117,11 +120,13 @@ local function step(dtime)
local players = {} local players = {}
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name() if player ~= nil then
local name = player:get_player_name()
players[name] = player
players[name] = player
nav.show_map(player)
nav.show_map(player)
end
end end
for wptname, wpt in pairs(nav.waypoints) do for wptname, wpt in pairs(nav.waypoints) do