[gnome-games] savestate: Don't error on missing screenshot aspect ratio



commit e314f335ee66407f20789634326f6dc01c76559d
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Thu Jan 30 01:11:17 2020 +0500

    savestate: Don't error on missing screenshot aspect ratio
    
    This can be a problem with migrated savestates, so just set it to 0.

 src/core/savestate.vala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/core/savestate.vala b/src/core/savestate.vala
index 43e84c01..e7ef4824 100644
--- a/src/core/savestate.vala
+++ b/src/core/savestate.vala
@@ -147,7 +147,11 @@ public class Games.Savestate : Object {
                var creation_date_str = keyfile.get_string ("Metadata", "Creation Date");
                creation_date = new DateTime.from_iso8601 (creation_date_str, new TimeZone.local ());
 
-               screenshot_aspect_ratio = keyfile.get_double ("Screenshot", "Aspect Ratio");
+               // Migrated savestates aren't going to have this
+               if (keyfile.has_group ("Screenshot"))
+                       screenshot_aspect_ratio = keyfile.get_double ("Screenshot", "Aspect Ratio");
+               else
+                       screenshot_aspect_ratio = 0;
        }
 
        protected virtual void save_metadata (KeyFile keyfile) {


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