Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix process effects crash #51827

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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