From 7dd7b5cc59561c306f7c7e7489a34d9fdf8b9e40 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Mon, 15 Jul 2024 21:47:10 +0100 Subject: [PATCH] menu: fix crash triggered by pipemenu without parent ...such as the one in the example below: We should consider supporting this construct in future. Reported-by: cry0xen via IRC --- src/menu/menu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/menu/menu.c b/src/menu/menu.c index 8f55808c..143a8233 100644 --- a/src/menu/menu.c +++ b/src/menu/menu.c @@ -506,6 +506,23 @@ handle_menu_element(xmlNode *n, struct server *server) if (execute && label && id) { wlr_log(WLR_DEBUG, "pipemenu '%s:%s:%s'", id, label, execute); + if (!current_menu) { + /* + * We currently do not support pipemenus without a + * parent such as the one the example below: + * + * + * + * + * + * + * TODO: Consider supporting this + */ + wlr_log(WLR_ERROR, + "pipemenu '%s:%s:%s' has no parent ", + id, label, execute); + goto error; + } current_item = item_create(current_menu, label, /* arrow */ true); current_item_action = NULL; current_item->execute = xstrdup(execute);