summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-09-20 18:36:47 +0200
committerFurkan Sahin <furkan-dev@proton.me>2018-09-20 18:36:47 +0200
commita651af2236bfe41a869209333d911bbcc20b83df (patch)
treea734e27f2c4045648a2baf67385ff761bcb96fa3
parent4132c82888d7a1dbdd4e4cea3c95ff64ac7bcea5 (diff)
parent7f2b2d67cf277b74dc845128afd1e5b31d54fdcb (diff)
Merge pull request #2671 from emersion/output-execute-no-focus
Fix segfault when executing command without focus
-rw-r--r--sway/commands.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 27a88319..07169f1e 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -216,18 +216,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;
}
}