mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +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
|
@ -1336,15 +1336,14 @@ void Server::handleCommand_RemovedSounds(NetworkPacket* pkt)
|
|||
|
||||
*pkt >> id;
|
||||
|
||||
std::unordered_map<s32, ServerPlayingSound>::iterator i =
|
||||
m_playing_sounds.find(id);
|
||||
auto i = m_playing_sounds.find(id);
|
||||
if (i == m_playing_sounds.end())
|
||||
continue;
|
||||
|
||||
ServerPlayingSound &psound = i->second;
|
||||
psound.clients.erase(pkt->getPeerId());
|
||||
if (psound.clients.empty())
|
||||
m_playing_sounds.erase(i++);
|
||||
m_playing_sounds.erase(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue