diff --git a/src/source_terms/source_term_handler.f90 b/src/source_terms/source_term_handler.f90 index b9163c80180..9b3c7110107 100644 --- a/src/source_terms/source_term_handler.f90 +++ b/src/source_terms/source_term_handler.f90 @@ -225,7 +225,12 @@ subroutine source_term_handler_add_source_term(this, source_term) integer :: n_sources, i - n_sources = size(this%source_terms) + if(allocated(this%source_terms)) then + n_sources = size(this%source_terms) + else + n_sources = 0 + endif + call move_alloc(this%source_terms, temp) allocate(this%source_terms(n_sources + 1))