[retro-gtk] retro-controller-iterator: Don't error on null parameters in next()



commit f625f2f4eabc27acf0c3ca43cb75952883caa06f
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Feb 2 16:07:55 2020 +0500

    retro-controller-iterator: Don't error on null parameters in next()
    
    They are marked as (optional), so g_return_val_if_fail() should not be
    used.
    
    Fixes https://gitlab.gnome.org/GNOME/retro-gtk/issues/28

 retro-gtk/retro-controller-iterator.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/retro-gtk/retro-controller-iterator.c b/retro-gtk/retro-controller-iterator.c
index d20554b..b9e0a30 100644
--- a/retro-gtk/retro-controller-iterator.c
+++ b/retro-gtk/retro-controller-iterator.c
@@ -48,11 +48,20 @@ retro_controller_iterator_next (RetroControllerIterator  *self,
                                 guint                   **port,
                                 RetroController         **controller)
 {
+  gpointer key, val;
+  gboolean ret;
+
   g_return_val_if_fail (RETRO_IS_CONTROLLER_ITERATOR (self), FALSE);
-  g_return_val_if_fail (port != NULL, FALSE);
-  g_return_val_if_fail (controller != NULL, FALSE);
 
-  return g_hash_table_iter_next (&self->iterator, (gpointer *) port, (gpointer *) controller);
+  ret = g_hash_table_iter_next (&self->iterator, &key, &val);
+
+  if (port)
+    *port = key;
+
+  if (controller)
+    *controller = val;
+
+  return ret;
 }
 
 /**


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