mirror of
https://github.com/SWG-Source/stationapi.git
synced 2026-01-16 23:04:18 -05:00
Added check for logged out client to prevent erase on erased pointer
This commit is contained in:
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
auto remove_iter
|
||||
= std::remove_if(std::begin(clients_), std::end(clients_), [](auto& client) {
|
||||
return client->GetConnection()->GetStatus() == UdpConnection::cStatusDisconnected;
|
||||
return client->GetConnection()->GetStatus() == UdpConnection::cStatusDisconnected || client == std::end(clients_);
|
||||
});
|
||||
|
||||
if (remove_iter != std::end(clients_))
|
||||
|
||||
@@ -72,6 +72,7 @@ void ChatAvatarService::LoginAvatar(ChatAvatar* avatar) {
|
||||
}
|
||||
|
||||
void ChatAvatarService::LogoutAvatar(ChatAvatar* avatar) {
|
||||
if(!avatar->isOnline_) return;
|
||||
avatar->isOnline_ = false;
|
||||
|
||||
onlineAvatars_.erase(std::remove_if(
|
||||
|
||||
Reference in New Issue
Block a user