[chronojump] Fixed bug on encoder FindPosOfBestN at inertial if curves wanted to be saved > curves.Count - start



commit 5b9df00c8fefa7e80c319d858fd264b767dbc8de
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Sep 2 13:14:38 2020 +0200

    Fixed bug on encoder FindPosOfBestN at inertial if curves wanted to be saved > curves.Count - start

 src/encoder.cs | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index c5f063a9..a30b1465 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -552,6 +552,9 @@ public class EncoderSignal
                if(curves.Count - start < n)
                        n = curves.Count - start;
 
+               if(n <= 0)
+                       return new List<int>();
+
                //2) make a copy of curves and have a new EncoderSignal to work with
                ArrayList curvesCopy = new ArrayList();
                foreach(EncoderCurve curve in curves)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]