summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2024-06-27 16:16:33 +0200
committerFurkan Sahin <furkan-dev@proton.me>2024-06-27 16:16:33 +0200
commitdf4e97100e4660d2e695dea4881445d9eadf03b9 (patch)
tree5be786adfbb01d5e3e61fd6b1be8772b1f6f67a3
parent0041f69068e88d91f7523ea52ba1b1cd6efa3c49 (diff)
prevent workspace_find_container from crashing with NULL workspaces
-rw-r--r--sway/tree/workspace.c5
1 files changed, 5 insertions, 0 deletions
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];