aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/lua_api/l_env.cpp2
1 files changed, 2 insertions, 0 deletions
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);