mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix some potential iterator invalidation issues
This commit is contained in:
parent
9ac6d330b4
commit
2b97fead9e
6 changed files with 12 additions and 17 deletions
|
@ -2924,12 +2924,11 @@ void Server::DeleteClient(session_t peer_id, ClientDeletionReason reason)
|
|||
/*
|
||||
Clear references to playing sounds
|
||||
*/
|
||||
for (std::unordered_map<s32, ServerPlayingSound>::iterator
|
||||
i = m_playing_sounds.begin(); i != m_playing_sounds.end();) {
|
||||
for (auto i = m_playing_sounds.begin(); i != m_playing_sounds.end();) {
|
||||
ServerPlayingSound &psound = i->second;
|
||||
psound.clients.erase(peer_id);
|
||||
if (psound.clients.empty())
|
||||
m_playing_sounds.erase(i++);
|
||||
i = m_playing_sounds.erase(i);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue