Update PlayerContainer.cpp (#1513)

Prevents a bad actor from possibly spamming the server with sequential IDs and allocating a bunch of memory.

Tested that I can still send and receive friend requests
This commit is contained in:
David Markowitz 2024-03-26 04:20:45 -07:00 committed by GitHub
parent 2b253a8248
commit 1e09ec92e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -390,7 +390,7 @@ LWOOBJID PlayerContainer::GetId(const std::u16string& playerName) {
}
PlayerData& PlayerContainer::GetPlayerDataMutable(const LWOOBJID& playerID) {
return m_Players[playerID];
return m_Players.contains(playerID) ? m_Players[playerID] : m_Players[LWOOBJID_EMPTY];
}
PlayerData& PlayerContainer::GetPlayerDataMutable(const std::string& playerName) {