aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-10-17 19:55:00 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-10-17 19:55:00 +1000
commit17014c34e2f3568af06b4fc9323256d2b7aa8947 (patch)
tree7f10ebd976c5f1eff4d33bd7d1b5530490d54317
parent434cbaabf092ec1688b4dfd2d93f38e849531d96 (diff)
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.
-rw-r--r--sway/commands/border.c2
-rw-r--r--sway/commands/mark.c2
-rw-r--r--sway/commands/title_format.c2
-rw-r--r--sway/commands/unmark.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/sway/commands/border.c b/sway/commands/border.c
index cc0d635a..2eed27bd 100644
--- a/sway/commands/border.c
+++ b/sway/commands/border.c
@@ -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");
}
diff --git a/sway/commands/mark.c b/sway/commands/mark.c
index fb95a7d0..b1f47be1 100644
--- a/sway/commands/mark.c
+++ b/sway/commands/mark.c
@@ -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");
}
diff --git a/sway/commands/title_format.c b/sway/commands/title_format.c
index c9ffe8fa..ef1c8935 100644
--- a/sway/commands/title_format.c
+++ b/sway/commands/title_format.c
@@ -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");
}
diff --git a/sway/commands/unmark.c b/sway/commands/unmark.c
index c6251dc8..c671ed4e 100644
--- a/sway/commands/unmark.c
+++ b/sway/commands/unmark.c
@@ -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");
}