From e2fc93022b46b86070651c5730664baaa363da72 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 25 Feb 2020 16:08:47 +0100 Subject: [PATCH] Fix potential problem with core.get_connected_players() --- src/script/lua_api/l_env.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 7d5de896d..ac52941b3 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -648,6 +648,8 @@ int ModApiEnvMod::l_get_connected_players(lua_State *L) lua_createtable(L, env->getPlayerCount(), 0); u32 i = 0; for (RemotePlayer *player : env->getPlayers()) { + if (player->getPeerId() == PEER_ID_INEXISTENT) + continue; PlayerSAO *sao = player->getPlayerSAO(); if (sao) { getScriptApiBase(L)->objectrefGetOrCreate(L, sao);