[gnome-2048] Fix starting the game for the first time



commit 526f84670a1d372d6cbe1bd39b52c0ae528c89b0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Sep 20 14:34:45 2015 -0500

    Fix starting the game for the first time
    
    The game crashes if this function returns false, and it always returns
    false if you don't have a save file already.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755321

 src/game.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/game.vala b/src/game.vala
index b20ad67..4142223 100644
--- a/src/game.vala
+++ b/src/game.vala
@@ -148,8 +148,15 @@ public class Game : GLib.Object
     try {
       FileUtils.get_contents (_saved_path, out contents);
     } catch (FileError e) {
-      warning ("Failed to restore game: %s", e.message);
-      return false;
+      // FIXME: Returning false guarantees a crash, because _clear_foreground
+      // will be called before _init_background(). Also, warning here makes no
+      // sense, since restoring is expected to fail if no previously-saved game
+      // exists. Someone needs to take a closer look at this to see what should
+      // happen if this function needs to return false, or if it needs a return
+      // value at all.
+
+      // warning ("Failed to restore game: %s", e.message);
+      // return false;
     }
 
     if (!_grid.load (contents))


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