From 0912ff36a74bace5b59ce15a3949b8ee07a67007 Mon Sep 17 00:00:00 2001 From: Jonathan Wilson Date: Sun, 21 Jan 2024 21:09:02 +1000 Subject: [PATCH] Fix particle system crash --- src/game/client/system/particlesystem/particlesysmanager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/client/system/particlesystem/particlesysmanager.cpp b/src/game/client/system/particlesystem/particlesysmanager.cpp index e8f9ba013..b367cc3ab 100644 --- a/src/game/client/system/particlesystem/particlesysmanager.cpp +++ b/src/game/client/system/particlesystem/particlesysmanager.cpp @@ -117,12 +117,15 @@ void ParticleSystemManager::Update() if (m_frame != g_theGameLogic->Get_Frame()) { m_frame = g_theGameLogic->Get_Frame(); - for (auto it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); it++) { + for (auto it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end();) { ParticleSystem *system = *it; if (system != nullptr) { if (!system->Update(m_playerIndex)) { + it++; system->Delete_Instance(); + } else { + it++; } } }