diff options
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/menuitem.c | 6 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 6540a70..6b8b505 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -715,6 +715,12 @@ DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) { g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + if (id == 0) { + if (dbusmenu_menuitem_get_root(mi) == FALSE) { + g_warning("Getting a menuitem with id zero, but it's not set as root."); + } + return mi; + } find_id_t find_id = {mi: NULL, id: id}; find_id_helper(mi, &find_id); return find_id.mi; diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index eb7c383..f8267c2 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -518,7 +518,7 @@ static gboolean _dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); - DbusmenuMenuitem * mi = id == 0 ? priv->root : dbusmenu_menuitem_find_id(priv->root, id); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { if (error != NULL) { |