sigProcLib: Check for bogus TOA before using it.
This commit is contained in:
parent
ded68da44f
commit
6512812e43
|
@ -1285,12 +1285,12 @@ static float computePeakRatio(signalVector *corr,
|
|||
complex *peak;
|
||||
float rms, avg = 0.0;
|
||||
|
||||
peak = corr->begin() + (int) rint(toa);
|
||||
|
||||
/* Check for bogus results */
|
||||
if ((toa < 0.0) || (toa > corr->size()))
|
||||
return 0.0;
|
||||
|
||||
peak = corr->begin() + (int) rint(toa);
|
||||
|
||||
for (int i = 2 * sps; i <= 5 * sps; i++) {
|
||||
if (peak - i >= corr->begin()) {
|
||||
avg += (peak - i)->norm2();
|
||||
|
|
Loading…
Reference in New Issue