Avoid a potential out-of-bounds error.

This commit is contained in:
Steve Franke 2019-04-30 08:54:42 -05:00
parent b2d6238b63
commit 0a12b34ec5
2 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,7 @@ subroutine ft4_downsample(dd,newdata,f0,c)
endif
i0=nint(f0/df)
c1=0.
c1(0)=cx(i0)
if(i0.ge.0 .and. i0.le.NMAX/2) c1(0)=cx(i0)
do i=1,NFFT2/2
if(i0+i.le.NMAX/2) c1(i)=cx(i0+i)
if(i0-i.ge.0) c1(NFFT2-i)=cx(i0-i)

View File

@ -69,6 +69,7 @@ subroutine getcandidates4(dd,fa,fb,syncmin,nfqso,maxcand,savg,candidate, &
del=0.
if(den.ne.0.0) del=0.5*(savsm(i-1)-savsm(i+1))/den
fpeak=(i+del)*df+f_offset
if(fpeak.lt.0.0 .or. fpeak.gt.4910.0) cycle
speak=savsm(i) - 0.25*(savsm(i-1)-savsm(i+1))*del
ncand=ncand+1
if(ncand.gt.maxcand) then