Fix malformed client ready packet crashing server

This commit is contained in:
cora 2022-02-15 02:16:05 +01:00
parent 18e299d923
commit 76b6815a7a
1 changed files with 23 additions and 0 deletions

View File

@ -204,3 +204,26 @@ local test_minetest_find_nodes_in_area_implementation_equivalence = function()
end
minetest.after( 0, test_minetest_find_nodes_in_area_implementation_equivalence )
--Workaround for Minetest bug #12073
-- <https://github.com/minetest/minetest/issues/12073#issuecomment-1039389509>
minetest.register_on_joinplayer(function(p)
p:get_meta():set_string("joined","true")
end)
minetest.register_on_leaveplayer(function(p)
p:get_meta():set_string("joined","")
end)
local function is_real_player(p)
if p:get_meta():get("joined") then return true end
end
local mgcp = minetest.get_connected_players
function minetest.get_connected_players()
local pp={}
for k,p in pairs(mgcp()) do
if is_real_player(p) then table.insert(pp,p) end
end
return pp
end