mirror of
https://github.com/swaywm/sway.git
synced 2026-04-20 06:47:03 -04:00
Handle seat_get_focused_workspace returning NULL
This modifiers the callers of seat_get_focused_workspace to handle getting NULL as the return value, if they did not already.
This commit is contained in:
parent
a280facd5f
commit
3330faded5
6 changed files with 27 additions and 7 deletions
|
|
@ -185,8 +185,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
struct sway_seat *seat = config->handler_context.seat;
|
||||
struct sway_workspace *current = seat_get_focused_workspace(seat);
|
||||
if (!current) {
|
||||
return cmd_results_new(CMD_FAILURE, "workspace",
|
||||
"No workspace to switch from");
|
||||
return cmd_results_new(CMD_FAILURE, "No workspace to switch from");
|
||||
}
|
||||
|
||||
struct sway_workspace *ws = NULL;
|
||||
|
|
@ -227,6 +226,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) {
|
|||
}
|
||||
free(name);
|
||||
}
|
||||
if (!ws) {
|
||||
return cmd_results_new(CMD_FAILURE, "No workspace to switch to");
|
||||
}
|
||||
workspace_switch(ws, no_auto_back_and_forth);
|
||||
seat_consider_warp_to_focus(seat);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue