aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar bretello <bretello@distruzione.org>2024-06-27 16:16:33 +0200
committerLibravatar Alexander Orzechowski <alex@ozal.ski>2024-06-27 10:19:53 -0400
commit8f6bc5bb36d1451dd51d91feabf2c91bf5bc1026 (patch)
tree5be786adfbb01d5e3e61fd6b1be8772b1f6f67a3
parentfix crash when setting urgency on an hidden scratchpad container (diff)
downloadsway-8f6bc5bb36d1451dd51d91feabf2c91bf5bc1026.tar.gz
sway-8f6bc5bb36d1451dd51d91feabf2c91bf5bc1026.tar.zst
sway-8f6bc5bb36d1451dd51d91feabf2c91bf5bc1026.zip
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,
708struct sway_container *workspace_find_container(struct sway_workspace *ws, 708struct sway_container *workspace_find_container(struct sway_workspace *ws,
709 bool (*test)(struct sway_container *con, void *data), void *data) { 709 bool (*test)(struct sway_container *con, void *data), void *data) {
710 struct sway_container *result = NULL; 710 struct sway_container *result = NULL;
711 if (ws == NULL){
712 sway_log(SWAY_ERROR, "Cannot find container with no workspace.");
713 return NULL;
714 }
715
711 // Tiling 716 // Tiling
712 for (int i = 0; i < ws->tiling->length; ++i) { 717 for (int i = 0; i < ws->tiling->length; ++i) {
713 struct sway_container *child = ws->tiling->items[i]; 718 struct sway_container *child = ws->tiling->items[i];