Skip to content

Commit

Permalink
Fix core.get_connected_players() returning unusable ObjectRefs
Browse files Browse the repository at this point in the history
This bug is only exposed by 91eef64
independent of the move of get_connected_players from Lua to C++.
Previously, there would be a small time window where the SAO had
its peer ID set to PEER_ID_INEXISTENT but the RemotePlayer was
still linked to the SAO, resulting in an ObjectRef that crashed
on certain function calls (#9387).
  • Loading branch information
sfan5 committed Mar 3, 2020
1 parent 7dffd08 commit 1761d7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/script/lua_api/l_env.cpp
Expand Up @@ -651,7 +651,7 @@ int ModApiEnvMod::l_get_connected_players(lua_State *L)
if (player->getPeerId() == PEER_ID_INEXISTENT)
continue;
PlayerSAO *sao = player->getPlayerSAO();
if (sao) {
if (sao && !sao->isGone()) {
getScriptApiBase(L)->objectrefGetOrCreate(L, sao);
lua_rawseti(L, -2, ++i);
}
Expand Down

0 comments on commit 1761d7d

Please sign in to comment.