aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vector.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vector.c b/src/vector.c
index b891111..83e44ce 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -435,7 +435,7 @@ int xtract_peak_spectrum(const float *data, const int N, const void *argv, float
for(n = 1; n < N; n++){
if(input[n] >= threshold){
- if(input[n] > input[n - 1] && input[n] > input[n + 1]){
+ if(input[n] > input[n - 1] && n + 1 < N && input[n] > input[n + 1]){
result[N + n] = q * (n + (p = .5 * ((y = input[n-1]) -
(y3 = input[n+1])) / (input[n - 1] - 2 *
(y2 = input[n]) + input[n + 1])));