diff options
author | Ted Gould <ted@gould.cx> | 2010-02-04 21:17:32 -0800 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-04 21:17:32 -0800 |
commit | 6203f12f1efe370b7f45ace7fe56ce1afd34337c (patch) | |
tree | 2d92e0f81a82d93a4f69aa3ae03030d8146511c8 /libdbusmenu-glib | |
parent | e7c73019f38016f3ccc630d74a312e4428e1acb9 (diff) | |
download | libdbusmenu-6203f12f1efe370b7f45ace7fe56ce1afd34337c.tar.gz libdbusmenu-6203f12f1efe370b7f45ace7fe56ce1afd34337c.tar.bz2 libdbusmenu-6203f12f1efe370b7f45ace7fe56ce1afd34337c.zip |
Making it so that find_id handles the root id being 0 case.
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) { |