[retro-gtk] retro-environment: Return in case of no input interface



commit 373437c4b26c16ff230a77845d956cf35a82389a
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu May 11 09:31:06 2017 +0200

    retro-environment: Return in case of no input interface
    
    Don't print criticals if the core has no input interface and simply
    return a default value as the an input interface isn't mandatory.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=782505

 retro-gtk/retro-environment.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/retro-gtk/retro-environment.c b/retro-gtk/retro-environment.c
index 8429c5d..67bcb7c 100644
--- a/retro-gtk/retro-environment.c
+++ b/retro-gtk/retro-environment.c
@@ -102,7 +102,8 @@ get_input_device_capabilities (RetroCore *self,
 
   input = retro_core_get_input_interface (self);
 
-  g_return_val_if_fail (input != NULL, FALSE);
+  if (input == NULL)
+    return FALSE;
 
   *capabilities = retro_input_get_device_capabilities (input);
 
@@ -208,7 +209,8 @@ set_input_descriptors (RetroCore            *self,
 
   input = retro_core_get_input_interface (self);
 
-  g_return_val_if_fail (input != NULL, FALSE);
+  if (input == NULL)
+    return FALSE;
 
   for (length = 0 ; descriptors[length].description ; length++);
   retro_input_set_descriptors (input, descriptors, length);
@@ -472,7 +474,7 @@ on_input_poll ()
   input = retro_core_get_input_interface (self);
 
   if (input == NULL)
-    g_return_if_reached ();
+    return;
 
   retro_input_poll (input);
 }
@@ -494,7 +496,7 @@ on_input_state (guint port,
   input = retro_core_get_input_interface (self);
 
   if (input == NULL)
-    g_return_val_if_reached (0);
+    return 0;
 
   return retro_input_get_state (input, port, device, index, id);
 }


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