[gnome-games] retro: Check if options file exists



commit 8f697f5a459b597cd8bc6b063a7910dc2054ad1d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Aug 15 01:47:21 2018 +0500

    retro: Check if options file exists
    
    Prevents runtime warning when the file is missing.

 src/retro/retro-runner.vala | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 9c901115..48f0709a 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -247,14 +247,15 @@ public class Games.RetroRunner : Object, Runner {
                core = new Retro.Core (module_path);
 
                var options_path = get_options_path ();
-               core.options_set.connect (() => {
-                       try {
-                               var options = new RetroOptions (options_path);
-                               options.apply (core);
-                       } catch (Error e) {
-                               critical (e.message);
-                       }
-               });
+               if (FileUtils.test (options_path, FileTest.EXISTS))
+                       core.options_set.connect (() => {
+                               try {
+                                       var options = new RetroOptions (options_path);
+                                       options.apply (core);
+                               } catch (Error e) {
+                                       critical (e.message);
+                               }
+                       });
 
                if (core_source != null) {
                        var platforms_dir = Application.get_platforms_dir ();


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