ipc: handle NULL cases for node_get_output

This commit is contained in:
Ian Fan 2018-09-15 09:42:46 +01:00
parent 1c292fd43a
commit 34dbbb1314
2 changed files with 8 additions and 3 deletions

View file

@ -74,8 +74,10 @@ void node_get_box(struct sway_node *node, struct wlr_box *box) {
struct sway_output *node_get_output(struct sway_node *node) {
switch (node->type) {
case N_CONTAINER:
return node->sway_container->workspace->output;
case N_CONTAINER: {
struct sway_workspace *ws = node->sway_container->workspace;
return ws ? ws->output : NULL;
}
case N_WORKSPACE:
return node->sway_workspace->output;
case N_OUTPUT: