[gnome-mahjongg] Fix critical warning in Game.timeout_cb



commit b0fa74c4179b87e56e27075224cd9159f40a4b40
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Mar 22 20:29:01 2014 -0500

    Fix critical warning in Game.timeout_cb
    
    https://bugzilla.gnome.org/show_bug.cgi?id=724389

 src/game.vala |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index 3168262..85a3145 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -464,13 +464,16 @@ public class Game
 
     private bool timeout_cb ()
     {
-        /* Notify on the next tick */
-        var elapsed = clock.elapsed ();
-        var next = (int) (elapsed + 1.0);
-        var wait = next - elapsed;
-        clock_timeout = Timeout.add ((int) (wait * 1000), timeout_cb);
+        if (clock != null)
+        {
+            /* Notify on the next tick */
+            var elapsed = clock.elapsed ();
+            var next = (int) (elapsed + 1.0);
+            var wait = next - elapsed;
+            clock_timeout = Timeout.add ((int) (wait * 1000), timeout_cb);
 
-        tick ();
+            tick ();
+        }
 
         return false;
     }


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