diff options
author | emersion <contact@emersion.fr> | 2018-09-19 15:21:04 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-09-19 15:50:42 +0200 |
commit | efc08ec8880b8078d35f687c7913f787efc85f72 (patch) | |
tree | 1c9d9c86ee1bc42cc6fb7f4af201babf04f4182f /sway/commands.c | |
parent | a83773e5cad9c3c988a664e177a885c61457c03a (diff) |
Fix segfault when executing command without focus
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c index 41e1c653..32079492 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -215,18 +215,23 @@ struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, static void set_config_node(struct sway_node *node) { config->handler_context.node = node; + config->handler_context.container = NULL; + config->handler_context.workspace = NULL; + + if (node == NULL) { + return; + } + switch (node->type) { case N_CONTAINER: config->handler_context.container = node->sway_container; config->handler_context.workspace = node->sway_container->workspace; break; case N_WORKSPACE: - config->handler_context.container = NULL; config->handler_context.workspace = node->sway_workspace; break; - default: - config->handler_context.container = NULL; - config->handler_context.workspace = NULL; + case N_ROOT: + case N_OUTPUT: break; } } |