From a7298314a47214f1eb630249e39b92354f800857 Mon Sep 17 00:00:00 2001 From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Wed, 22 May 2024 03:36:33 +0200 Subject: [PATCH] src/config/rcxml.c: ensure parent action is available Before this patch, having a branch or query with an invalid or missing parent action would trigger an assert when trying to access the parent. This patch ensures that we bail out instead. Reported-by: fuyukai via IRC (thanks) --- src/config/rcxml.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 164e329c..4af7ed46 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -289,6 +289,11 @@ fill_region(char *nodename, char *content) static void fill_action_query(char *nodename, char *content, struct action *action) { + if (!action) { + wlr_log(WLR_ERROR, "No parent action for query: %s=%s", nodename, content); + return; + } + string_truncate_at_pattern(nodename, ".keybind.keyboard"); string_truncate_at_pattern(nodename, ".mousebind.context.mouse"); @@ -325,6 +330,11 @@ static void fill_child_action(char *nodename, char *content, struct action *parent, const char *branch_name) { + if (!parent) { + wlr_log(WLR_ERROR, "No parent action for branch: %s=%s", nodename, content); + return; + } + string_truncate_at_pattern(nodename, ".keybind.keyboard"); string_truncate_at_pattern(nodename, ".mousebind.context.mouse"); string_truncate_at_pattern(nodename, ".then.action");