diff --git a/src/swiftest/swiftest_io.f90 b/src/swiftest/swiftest_io.f90 index 68e34e33b..343da3be6 100644 --- a/src/swiftest/swiftest_io.f90 +++ b/src/swiftest/swiftest_io.f90 @@ -265,8 +265,8 @@ module subroutine swiftest_io_dump_system(self, param) if (idx > NDUMPFILES) idx = 1 ! Dump the encounter history if necessary - if (param%lenc_save_trajectory .or. param%lenc_save_closest) call self%encounter_history%dump(param) - call self%collision_history%dump(param) + if (param%lenc_save_trajectory .or. param%lenc_save_closest .and. allocated(self%encounter_history)) call self%encounter_history%dump(param) + if (allocated(self%collision_history)) call self%collision_history%dump(param) ! Dump the nbody_system history to file call param%system_history%dump(param)