mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
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)
This commit is contained in:
parent
23b96ad2a6
commit
a7298314a4
1 changed files with 10 additions and 0 deletions
|
|
@ -289,6 +289,11 @@ fill_region(char *nodename, char *content)
|
||||||
static void
|
static void
|
||||||
fill_action_query(char *nodename, char *content, struct action *action)
|
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, ".keybind.keyboard");
|
||||||
string_truncate_at_pattern(nodename, ".mousebind.context.mouse");
|
string_truncate_at_pattern(nodename, ".mousebind.context.mouse");
|
||||||
|
|
||||||
|
|
@ -325,6 +330,11 @@ static void
|
||||||
fill_child_action(char *nodename, char *content, struct action *parent,
|
fill_child_action(char *nodename, char *content, struct action *parent,
|
||||||
const char *branch_name)
|
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, ".keybind.keyboard");
|
||||||
string_truncate_at_pattern(nodename, ".mousebind.context.mouse");
|
string_truncate_at_pattern(nodename, ".mousebind.context.mouse");
|
||||||
string_truncate_at_pattern(nodename, ".then.action");
|
string_truncate_at_pattern(nodename, ".then.action");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue