Skip to content

Commit d5cb1c0

Browse files
committed
add callback input check
1 parent 1ee805b commit d5cb1c0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/hompack_nf.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,19 @@ impure subroutine fixpnf( &
317317
! of any component of y exceeds cursw
318318
real(dp), parameter :: cursw = 10.0_dp
319319

320+
! Check callbacks are present
321+
if (iflag == 0 .or. iflag == -1) then
322+
if (.not. associated(callbacks%f) .or. .not. associated(callbacks%fjac)) then
323+
iflag = 7
324+
return
325+
end if
326+
else if (iflag == -2) then
327+
if (.not. associated(callbacks%rho) .or. .not. associated(callbacks%rhojac)) then
328+
iflag = 7
329+
return
330+
end if
331+
end if
332+
320333
! Test logical switch to reflect intended usage of 'fixpnf'
321334
if (present(poly_switch)) then
322335
polsys = poly_switch

0 commit comments

Comments
 (0)