mirror of
https://github.com/swaywm/sway.git
synced 2024-11-29 19:31:29 +00:00
Fix crashes when running certain commands on an empty workspace
This fixes crashes when running the border, mark, unmark and title_format commands on an empty workspace.
This commit is contained in:
parent
434cbaabf0
commit
17014c34e2
|
@ -59,7 +59,7 @@ struct cmd_results *cmd_border(int argc, char **argv) {
|
|||
}
|
||||
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container->view) {
|
||||
if (!container || !container->view) {
|
||||
return cmd_results_new(CMD_INVALID, "border",
|
||||
"Only views can have borders");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container->view) {
|
||||
if (!container || !container->view) {
|
||||
return cmd_results_new(CMD_INVALID, "mark",
|
||||
"Only views can have marks");
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ struct cmd_results *cmd_title_format(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container->view) {
|
||||
if (!container || !container->view) {
|
||||
return cmd_results_new(CMD_INVALID, "title_format",
|
||||
"Only views can have a title_format");
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ struct cmd_results *cmd_unmark(int argc, char **argv) {
|
|||
struct sway_view *view = NULL;
|
||||
if (config->handler_context.using_criteria) {
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container->view) {
|
||||
if (!container || !container->view) {
|
||||
return cmd_results_new(CMD_INVALID, "unmark",
|
||||
"Only views can have marks");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue