mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16: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
|
@ -1616,9 +1616,8 @@ void ServerEnvironment::step(float dtime)
|
|||
Manage particle spawner expiration
|
||||
*/
|
||||
if (m_particle_management_interval.step(dtime, 1.0)) {
|
||||
for (std::unordered_map<u32, float>::iterator i = m_particle_spawners.begin();
|
||||
i != m_particle_spawners.end(); ) {
|
||||
//non expiring spawners
|
||||
for (auto i = m_particle_spawners.begin(); i != m_particle_spawners.end(); ) {
|
||||
// non expiring spawners
|
||||
if (i->second == PARTICLE_SPAWNER_NO_EXPIRY) {
|
||||
++i;
|
||||
continue;
|
||||
|
@ -1626,7 +1625,7 @@ void ServerEnvironment::step(float dtime)
|
|||
|
||||
i->second -= 1.0f;
|
||||
if (i->second <= 0.f)
|
||||
m_particle_spawners.erase(i++);
|
||||
i = m_particle_spawners.erase(i);
|
||||
else
|
||||
++i;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue