[retro-gtk/core-fixes: 8/8] core: Check controller in retro_core_set_controller()
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/core-fixes: 8/8] core: Check controller in retro_core_set_controller()
- Date: Sun, 16 Feb 2020 17:13:33 +0000 (UTC)
commit dc84f248aad6f4fd3abf65257a35b9fda838e9e6
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 556dbab..3820dce 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]