Skip to content

Commit

Permalink
Fix process effects crash (#51827)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferociousdork authored Sep 23, 2021
1 parent 85c3ddd commit 6ee1821
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8904,7 +8904,9 @@ void Character::process_effects()
int_bonus_hardcoded = 0;
per_bonus_hardcoded = 0;
//Human only effects
for( std::pair<const efftype_id, std::map<bodypart_id, effect>> &elem : *effects ) {
effects_map effects_copy = *effects;
// Iterate over a copy, process_one_effect modifies the effects map, potentially invalidating iterators.
for( std::pair<const efftype_id, std::map<bodypart_id, effect>> &elem : effects_copy ) {
for( std::pair<const bodypart_id, effect> &_effect_it : elem.second ) {
process_one_effect( _effect_it.second, false );
}
Expand Down

0 comments on commit 6ee1821

Please sign in to comment.