diff options
author | emersion <contact@emersion.fr> | 2018-09-20 18:36:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-20 18:36:47 +0200 |
commit | fa4308c5abecaeef870aced574e9d05e24e62392 (patch) | |
tree | a734e27f2c4045648a2baf67385ff761bcb96fa3 /sway/commands.c | |
parent | Merge pull request #2676 from ianyfan/ipc (diff) | |
parent | Fix segfault when executing command without focus (diff) | |
download | sway-fa4308c5abecaeef870aced574e9d05e24e62392.tar.gz sway-fa4308c5abecaeef870aced574e9d05e24e62392.tar.zst sway-fa4308c5abecaeef870aced574e9d05e24e62392.zip |
Merge pull request #2671 from emersion/output-execute-no-focus
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 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, | |||
216 | 216 | ||
217 | static void set_config_node(struct sway_node *node) { | 217 | static void set_config_node(struct sway_node *node) { |
218 | config->handler_context.node = node; | 218 | config->handler_context.node = node; |
219 | config->handler_context.container = NULL; | ||
220 | config->handler_context.workspace = NULL; | ||
221 | |||
222 | if (node == NULL) { | ||
223 | return; | ||
224 | } | ||
225 | |||
219 | switch (node->type) { | 226 | switch (node->type) { |
220 | case N_CONTAINER: | 227 | case N_CONTAINER: |
221 | config->handler_context.container = node->sway_container; | 228 | config->handler_context.container = node->sway_container; |
222 | config->handler_context.workspace = node->sway_container->workspace; | 229 | config->handler_context.workspace = node->sway_container->workspace; |
223 | break; | 230 | break; |
224 | case N_WORKSPACE: | 231 | case N_WORKSPACE: |
225 | config->handler_context.container = NULL; | ||
226 | config->handler_context.workspace = node->sway_workspace; | 232 | config->handler_context.workspace = node->sway_workspace; |
227 | break; | 233 | break; |
228 | default: | 234 | case N_ROOT: |
229 | config->handler_context.container = NULL; | 235 | case N_OUTPUT: |
230 | config->handler_context.workspace = NULL; | ||
231 | break; | 236 | break; |
232 | } | 237 | } |
233 | } | 238 | } |