Disconnect before deleting the session

The session was deleted from `m_Sessions` before disconnecting. Since
e7a583adc0 that also deleted the session.
This commit is contained in:
phosit 2026-05-02 10:06:01 +02:00
parent a95579a046
commit 34ab0f3938
No known key found for this signature in database
GPG key ID: C9430B600671C268

View file

@ -496,14 +496,13 @@ bool CNetServerWorker::RunStep()
// Remove the session first, so we won't send player-update messages to it
// when updating the FSM
std::erase_if(m_Sessions, [&](const auto& s)
{
return s.get() == session;
});
const auto iter = std::ranges::find(m_Sessions, session,
&std::unique_ptr<CNetServerSession>::get);
const std::unique_ptr<CNetServerSession> _ = std::move(*iter);
m_Sessions.erase(iter);
session->Update((uint)NMT_CONNECTION_LOST, NULL);
delete session;
event.peer->data = NULL;
}