From 34dbbb1314af16e388c7517aec6427baa00fb179 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sat, 15 Sep 2018 09:42:46 +0100 Subject: ipc: handle NULL cases for node_get_output --- sway/tree/node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sway/tree') diff --git a/sway/tree/node.c b/sway/tree/node.c index 74661c1a..dcab1c9b 100644 --- a/sway/tree/node.c +++ b/sway/tree/node.c @@ -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: -- cgit v1.2.3