Skip to content

Commit

Permalink
prevent segfault if you do not have profession (for any technical rea…
Browse files Browse the repository at this point in the history
…son)
  • Loading branch information
GuardianDll committed Jan 17, 2025
1 parent e643d7d commit bfd5fc2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/effect_on_condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ void effect_on_conditions::load_new_character( Character &you )
}
}

for( const effect_on_condition_id &eoc_id : you.get_profession()->get_eocs() ) {
effect_on_condition eoc = eoc_id.obj();
if( eoc.type == eoc_type::PROFESSION_SPECIFIC && ( is_avatar || eoc.run_for_npcs ) ) {
queued_eoc new_eoc = queued_eoc{ eoc.id, calendar::turn_zero, {} };
you.queued_effect_on_conditions.push( new_eoc );
if( you.get_profession() ) {
for( const effect_on_condition_id &eoc_id : you.get_profession()->get_eocs() ) {
effect_on_condition eoc = eoc_id.obj();
if( eoc.type == eoc_type::PROFESSION_SPECIFIC && ( is_avatar || eoc.run_for_npcs ) ) {
queued_eoc new_eoc = queued_eoc{ eoc.id, calendar::turn_zero, {} };
you.queued_effect_on_conditions.push( new_eoc );
}
}
}

Expand Down

0 comments on commit bfd5fc2

Please sign in to comment.