[retro-gtk/core-fixes: 9/9] core: Check controller in retro_core_set_controller()



commit 7bb2f2f7bc0e50927ab6a3aef2d40fd6e3cf2722
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Feb 16 15:08:47 2020 +0100

    core: Check controller in retro_core_set_controller()
    
    The precondition should be checked to warn of wrong usages.

 retro-gtk/retro-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/retro-gtk/retro-core.c b/retro-gtk/retro-core.c
index 55ce0fb..610f6e9 100644
--- a/retro-gtk/retro-core.c
+++ b/retro-gtk/retro-core.c
@@ -1668,8 +1668,9 @@ retro_core_set_controller (RetroCore       *self,
   RetroCoreControllerInfo *info;
 
   g_return_if_fail (RETRO_IS_CORE (self));
+  g_return_if_fail (controller == NULL || RETRO_IS_CONTROLLER (controller));
 
-  if (RETRO_IS_CONTROLLER (controller)) {
+  if (controller != NULL) {
     info = g_new0 (RetroCoreControllerInfo, 1);
     gint fd;
     g_autofree gchar *name = NULL;


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