changeset 1283:2f468f43c02c 3.0-integration

Warn when out-of-range bin requested
author Chris Cannam
date Wed, 23 Nov 2016 10:38:53 +0000
parents 56c06dc0937c
children 16a8e97179d7 4704e834d0f9
files base/ColumnOp.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/base/ColumnOp.cpp	Wed Nov 23 10:35:10 2016 +0000
+++ b/base/ColumnOp.cpp	Wed Nov 23 10:38:53 2016 +0000
@@ -19,6 +19,8 @@
 #include <algorithm>
 #include <iostream>
 
+#include "base/Debug.h"
+
 using namespace std;
 
 ColumnOp::Column
@@ -146,6 +148,11 @@
 
             int by0 = int(sy0 + 0.0001);
             int by1 = int(sy1 + 0.0001);
+
+            if (by0 < 0 || by0 >= bins || by1 > bins) {
+                SVCERR << "ERROR: bin index out of range in ColumnOp::distribute: by0 = " << by0 << ", by1 = " << by1 << ", sy0 = " << sy0 << ", sy1 = " << sy1 << ", y = " << y << ", binfory[y] = " << binfory[y] << ", minbin = " << minbin << ", bins = " << bins << endl;
+                continue;
+            }
                 
             for (int bin = by0; bin == by0 || bin < by1; ++bin) {