From 47e4ab4f80149f1cfd2aa8b259208501ffdb2104 Mon Sep 17 00:00:00 2001 From: T1ti <40864460+T1ti@users.noreply.github.com> Date: Fri, 30 Aug 2024 23:12:34 +0200 Subject: [PATCH] adspartan : particle: fix ribbon iterator issue https://github.com/wowdev/noggit3/commit/07daf2120ffaa032e2191d1e3940b6757dba694c --- src/noggit/Particle.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/noggit/Particle.cpp b/src/noggit/Particle.cpp index d56d2dd3..4ca6faee 100755 --- a/src/noggit/Particle.cpp +++ b/src/noggit/Particle.cpp @@ -889,18 +889,23 @@ void RibbonEmitter::setup(int anim, int time, int animtime) // kill stuff from the end TODO: occasional crashes here float l = 0; bool erasemode = false; - for (std::list::iterator it = segs.begin(); it != segs.end();) { - if (!erasemode) { + for (std::list::iterator it = segs.begin(); it != segs.end();) + { + if (!erasemode) + { l += it->len; - if (l > length) { - it->len = l - length; - erasemode = true; + if (l > length) + { + it->len = l - length; + erasemode = true; } + + ++it; } - else { - segs.erase(it); + else + { + it = segs.erase(it); } - ++it; } tpos = ntpos;