diff --git a/src/training/input_record.rs b/src/training/input_record.rs index 89dd16c..d74c079 100644 --- a/src/training/input_record.rs +++ b/src/training/input_record.rs @@ -173,10 +173,12 @@ fn into_transition_term(starting_status: StartingStatus) -> i32 { } pub unsafe fn handle_recording() { - let player_module_accessor = get_module_accessor(FighterId::Player); - let cpu_module_accessor = get_module_accessor(FighterId::CPU); - handle_recording_for_fighter(&mut *player_module_accessor); - handle_recording_for_fighter(&mut *cpu_module_accessor); + let player_module_accessor = try_get_module_accessor(FighterId::Player); + let cpu_module_accessor = try_get_module_accessor(FighterId::CPU); + if player_module_accessor.is_some() && cpu_module_accessor.is_some() { + handle_recording_for_fighter(&mut *player_module_accessor.unwrap()); + handle_recording_for_fighter(&mut *cpu_module_accessor.unwrap()); + } } unsafe fn handle_recording_for_fighter(module_accessor: &mut BattleObjectModuleAccessor) {