diff options
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 2 | ||||
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 13 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 44312a8..b0b1157 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -486,6 +486,8 @@ dbusmenu_client_new (const gchar * name, const gchar * object) DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient * client) { + g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), NULL); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); if (priv->layoutcall != NULL) { diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index f228059..742fc93 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -198,6 +198,8 @@ dbusmenu_menuitem_new_with_id (guint id) guint dbusmenu_menuitem_get_id (DbusmenuMenuitem * mi) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), 0); + GValue retval = {0}; g_value_init(&retval, G_TYPE_UINT); g_object_get_property(G_OBJECT(mi), "id", &retval); @@ -289,6 +291,9 @@ dbusmenu_menuitem_get_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * parent gboolean dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(child), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_append(priv->children, child); return TRUE; @@ -308,6 +313,9 @@ dbusmenu_menuitem_child_append (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) gboolean dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(child), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_remove(priv->children, child); return TRUE; @@ -328,6 +336,9 @@ dbusmenu_menuitem_child_delete (DbusmenuMenuitem * mi, DbusmenuMenuitem * child) gboolean dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(child), FALSE); + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); priv->children = g_list_insert(priv->children, child, position); return TRUE; @@ -347,6 +358,8 @@ dbusmenu_menuitem_child_add_position (DbusmenuMenuitem * mi, DbusmenuMenuitem * DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, guint id) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + GList * childs = dbusmenu_menuitem_get_children(mi); if (childs == NULL) return NULL; diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index bb5bd8d..3db6db0 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -317,6 +317,9 @@ dbusmenu_server_new (const gchar * object) void dbusmenu_server_set_root (DbusmenuServer * self, DbusmenuMenuitem * root) { + g_return_if_fail(DBUSMENU_IS_SERVER(self)); + g_return_if_fail(DBUSMENU_IS_MENUITEM(root)); + g_debug("Setting root object: 0x%X", (unsigned int)root); GValue rootvalue = {0}; g_value_init(&rootvalue, G_TYPE_OBJECT); |