diff options
author | 2019-02-05 22:09:59 +0100 | |
---|---|---|
committer | 2019-02-05 22:09:59 +0100 | |
commit | a3c531485631698109073d338da956ccaaf0a7e0 (patch) | |
tree | 1f073eead802b2db385f1986373dcabd1171a00e | |
parent | Merge pull request #3582 from c-edw/FixUninitializedInputManager (diff) | |
parent | output_cmd_background: fix no file + valid mode (diff) | |
download | sway-a3c531485631698109073d338da956ccaaf0a7e0.tar.gz sway-a3c531485631698109073d338da956ccaaf0a7e0.tar.zst sway-a3c531485631698109073d338da956ccaaf0a7e0.zip |
Merge pull request #3587 from RedSoxFan/fix-background-missing-file
output_cmd_background: fix no file + valid mode
-rw-r--r-- | common/stringop.c | 3 | ||||
-rw-r--r-- | sway/commands/output/background.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/common/stringop.c b/common/stringop.c index 8af0d60f..709be684 100644 --- a/common/stringop.c +++ b/common/stringop.c | |||
@@ -258,6 +258,9 @@ int unescape_string(char *string) { | |||
258 | } | 258 | } |
259 | 259 | ||
260 | char *join_args(char **argv, int argc) { | 260 | char *join_args(char **argv, int argc) { |
261 | if (!sway_assert(argc > 0, "argc should be positive")) { | ||
262 | return NULL; | ||
263 | } | ||
261 | int len = 0, i; | 264 | int len = 0, i; |
262 | for (i = 0; i < argc; ++i) { | 265 | for (i = 0; i < argc; ++i) { |
263 | len += strlen(argv[i]) + 1; | 266 | len += strlen(argv[i]) + 1; |
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index f65904bb..5a15ed0f 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c | |||
@@ -61,6 +61,9 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { | |||
61 | return cmd_results_new(CMD_INVALID, | 61 | return cmd_results_new(CMD_INVALID, |
62 | "Missing background scaling mode."); | 62 | "Missing background scaling mode."); |
63 | } | 63 | } |
64 | if (j == 0) { | ||
65 | return cmd_results_new(CMD_INVALID, "Missing background file"); | ||
66 | } | ||
64 | 67 | ||
65 | wordexp_t p = {0}; | 68 | wordexp_t p = {0}; |
66 | char *src = join_args(argv, j); | 69 | char *src = join_args(argv, j); |