mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix potential access violation due to iterator invalidation
This commit is contained in:
parent
da7766e90b
commit
7a5258853a
@ -348,7 +348,11 @@ void BattleStacksController::update()
|
||||
|
||||
void BattleStacksController::updateBattleAnimations()
|
||||
{
|
||||
for (auto & elem : currentAnimations)
|
||||
// operate on copy - to prevent potential iterator invalidation due to push_back's
|
||||
// FIXME? : remove remaining calls to addNewAnim from BattleAnimation::nextFrame (only Catapult explosion at the time of writing)
|
||||
auto copiedVector = currentAnimations;
|
||||
|
||||
for (auto & elem : copiedVector)
|
||||
{
|
||||
if (!elem)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user