mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-21 11:55:43 +02:00
Fix some potential iterator invalidation issues
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user