From c269413c173545fd431d9327ddc762aaeb4f4089 Mon Sep 17 00:00:00 2001 From: Scott Leggett Date: Wed, 27 May 2026 09:35:39 +0800 Subject: [PATCH] commands/focus: handle NULL workspace in focus_mode Avoid executing `focus tiling` on a container that is in the scratchpad, and therefore has a NULL workspace. --- sway/commands/focus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sway/commands/focus.c b/sway/commands/focus.c index facd82de7..2a4f5d0e9 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -260,6 +260,10 @@ static struct sway_node *node_get_in_direction_floating( static struct cmd_results *focus_mode(struct sway_workspace *ws, struct sway_seat *seat, bool floating) { + if (!ws) { + return cmd_results_new(CMD_FAILURE, + "Target container is not in a workspace"); + } struct sway_container *new_focus = NULL; if (floating) { new_focus = seat_get_focus_inactive_floating(seat, ws);