From 647f592ddb2608896037fb6a7dffcec35c49f4e2 Mon Sep 17 00:00:00 2001 From: ferociousdork <78301810+ferociousdork@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:42:59 +0200 Subject: [PATCH] Fix process effects crash --- src/character.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/character.cpp b/src/character.cpp index 8c9becee5c0df..17360c0969d3d 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -8904,7 +8904,9 @@ void Character::process_effects() int_bonus_hardcoded = 0; per_bonus_hardcoded = 0; //Human only effects - for( std::pair> &elem : *effects ) { + effects_map effects_copy = *effects; + // Iterate over a copy, process_one_effect modifies the effects map, potentially invalidating iterators. + for( std::pair> &elem : effects_copy ) { for( std::pair &_effect_it : elem.second ) { process_one_effect( _effect_it.second, false ); }