[longomatch] Make sure we don't throw a null ref exception when timer is not stopped yet.



commit 9f2a5b56ad3129edb7f9c1d34d081783dac3b34e
Author: Julien Moutte <julien fluendo com>
Date:   Tue Apr 28 15:30:17 2015 +0200

    Make sure we don't throw a null ref exception when timer is not stopped yet.
    
    This fixes show project stats when a timer is running.

 LongoMatch.Core/Store/TimeNode.cs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Store/TimeNode.cs b/LongoMatch.Core/Store/TimeNode.cs
index 25dcb7d..4fb2433 100644
--- a/LongoMatch.Core/Store/TimeNode.cs
+++ b/LongoMatch.Core/Store/TimeNode.cs
@@ -98,10 +98,14 @@ namespace LongoMatch.Core.Store
                [JsonIgnore]
                public Time Duration {
                        get {
-                               return Stop-Start;
+                               if (Stop != null && Start != null) {
+                                       return Stop - Start;
+                               } else {
+                                       return new Time (0);
+                               }
                        }
                }
-               
+
                /// <summary>
                /// Play rate
                /// </summary>


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