[chronojump] Fixed crash on tests limited by time with more intervalTimes than distancesString



commit 15aedf233fc1e8e93f9fa8fb98f6a3ef83c5f6a7
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jun 14 14:18:05 2016 +0200

    Fixed crash on tests limited by time with more intervalTimes than distancesString

 src/util.cs |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/util.cs b/src/util.cs
index cc67b7b..9493a9d 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1695,7 +1695,8 @@ public class Util
                        return tracks * distanceInterval;
        }
 
-       public static double GetRunIVariableDistancesSpeeds(string distancesString, string timesString, bool 
max) {
+       public static double GetRunIVariableDistancesSpeeds(string distancesString, string timesString, bool 
max) 
+       {
                double  searchedValue = -1; //to find max values (higher than this)
                if(! max)
                        searchedValue = 1000; //to find min values (lower than this)
@@ -1707,6 +1708,14 @@ public class Util
                
                        int distPos = i % times.Length;
 
+                       /*
+                        * A test limited by time or undefined can have 
+                        * timesString: 3,595518=6,971076=7,427422=8,109596 (4 values) 
+                        * and distancesString 12-3-5 (3 values)
+                        */
+                       if(distPos >= distances.Length)
+                               continue;
+
                        //RSA is not counted as speed
                        if(distances[distPos].StartsWith("R"))
                                continue;


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