diff --git a/src/Utilities/BudgetTerm.f90 b/src/Utilities/BudgetTerm.f90 index 4dd332dc89f..2722d49abe9 100644 --- a/src/Utilities/BudgetTerm.f90 +++ b/src/Utilities/BudgetTerm.f90 @@ -205,24 +205,26 @@ subroutine save_flows(this, dis, ibinun, kstp, kper, delt, pertim, totim, & end do ! ! -- Write the header - call ubdsv06(kstp, kper, this%flowtype, & - this%text1id1, this%text2id1, & - this%text1id2, this%text2id2, & - ibinun, this%naux, this%auxtxt, & - nlist, 1, 1, nlist, & - iout, delt, pertim, totim) - ! - ! -- Write each entry - do i = 1, this%nlist - q = this%flow(i) - n1 = this%id1(i) - n2 = this%id2(i) - if (n1 <= 0 .or. n2 <= 0) cycle - call dis%record_mf6_list_entry(ibinun, n1, n2, q, & - this%naux, this%auxvar(:, i), & - olconv=this%olconv1, & - olconv2=this%olconv2) - end do + if (nlist > 0) then + call ubdsv06(kstp, kper, this%flowtype, & + this%text1id1, this%text2id1, & + this%text1id2, this%text2id2, & + ibinun, this%naux, this%auxtxt, & + nlist, 1, 1, nlist, & + iout, delt, pertim, totim) + ! + ! -- Write each entry + do i = 1, this%nlist + q = this%flow(i) + n1 = this%id1(i) + n2 = this%id2(i) + if (n1 <= 0 .or. n2 <= 0) cycle + call dis%record_mf6_list_entry(ibinun, n1, n2, q, & + this%naux, this%auxvar(:, i), & + olconv=this%olconv1, & + olconv2=this%olconv2) + end do + end if ! end subroutine save_flows