From 8f6bc5bb36d1451dd51d91feabf2c91bf5bc1026 Mon Sep 17 00:00:00 2001 From: bretello Date: Thu, 27 Jun 2024 16:16:33 +0200 Subject: [PATCH] prevent workspace_find_container from crashing with NULL workspaces --- sway/tree/workspace.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 52e48ad5..f8709a4c 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -708,6 +708,11 @@ void workspace_for_each_container(struct sway_workspace *ws, struct sway_container *workspace_find_container(struct sway_workspace *ws, bool (*test)(struct sway_container *con, void *data), void *data) { struct sway_container *result = NULL; + if (ws == NULL){ + sway_log(SWAY_ERROR, "Cannot find container with no workspace."); + return NULL; + } + // Tiling for (int i = 0; i < ws->tiling->length; ++i) { struct sway_container *child = ws->tiling->items[i];