[gnome-bluetooth/wip/hadess/fix-keyboard-cancel: 1/10] lib: Add guards to helper functions
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/fix-keyboard-cancel: 1/10] lib: Add guards to helper functions
- Date: Fri, 19 Feb 2021 12:10:42 +0000 (UTC)
commit 5f9f962c4d67f7bdde3b53e402028bbc65319b20
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 19 12:23:08 2021 +0100
lib: Add guards to helper functions
Clear warnings are better than crashes.
lib/bluetooth-client.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 5a149353..607da321 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -163,9 +163,10 @@ compare_address (GtkTreeStore *store,
static gboolean
get_iter_from_path (GtkTreeStore *store,
- GtkTreeIter *iter,
- const char *path)
+ GtkTreeIter *iter,
+ const char *path)
{
+ g_return_val_if_fail (path != NULL, FALSE);
return iter_search(store, iter, NULL, compare_path, (gpointer) path);
}
@@ -174,6 +175,7 @@ get_iter_from_proxy(GtkTreeStore *store,
GtkTreeIter *iter,
GDBusProxy *proxy)
{
+ g_return_val_if_fail (proxy != NULL, FALSE);
return iter_search(store, iter, NULL, compare_path,
(gpointer) g_dbus_proxy_get_object_path (proxy));
}
@@ -186,6 +188,9 @@ get_iter_from_address (GtkTreeStore *store,
{
GtkTreeIter parent_iter;
+ g_return_val_if_fail (address != NULL, FALSE);
+ g_return_val_if_fail (adapter != NULL, FALSE);
+
if (get_iter_from_proxy (store, &parent_iter, adapter) == FALSE)
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]