[longomatch] Fix exception gathering playing time stats for players



commit 14e826b7e136a019081e56ac96401d6d00ef96e6
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Dec 11 14:46:51 2014 +0100

    Fix exception gathering playing time stats for players

 LongoMatch.Core/Stats/PlayerStats.cs |    5 +++++
 LongoMatch.Core/Store/TimeNode.cs    |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/Stats/PlayerStats.cs b/LongoMatch.Core/Stats/PlayerStats.cs
index 3319402..ab10f1d 100644
--- a/LongoMatch.Core/Stats/PlayerStats.cs
+++ b/LongoMatch.Core/Stats/PlayerStats.cs
@@ -117,6 +117,11 @@ namespace LongoMatch.Core.Stats
                                }
                        }
 
+                       /* If the last substitution was Player IN */
+                       if (last.Stop == null) {
+                               last.Stop = project.Description.FileSet.Duration;
+                       }
+
                        playingTimeNodes = new List<TimeNode> ();
                        /* Get the real playing time intersecting with the periods */
                        foreach (TimeNode timenode in timenodes) {
diff --git a/LongoMatch.Core/Store/TimeNode.cs b/LongoMatch.Core/Store/TimeNode.cs
index b6ab13b..19acaab 100644
--- a/LongoMatch.Core/Store/TimeNode.cs
+++ b/LongoMatch.Core/Store/TimeNode.cs
@@ -133,6 +133,8 @@ namespace LongoMatch.Core.Store
                }
                
                public TimeNode Intersect (TimeNode tn) {
+                       if (tn.Stop == null || tn.Start == null || Start == null || Stop == null)
+                               return null;
                        if (tn.Stop < Start || tn.Start > Stop)
                                return null;
                        else


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