Merge pull request #3587 from RedSoxFan/fix-background-missing-file

output_cmd_background: fix no file + valid mode
master
Drew DeVault 6 years ago committed by GitHub
commit a3c5314856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -258,6 +258,9 @@ int unescape_string(char *string) {
} }
char *join_args(char **argv, int argc) { char *join_args(char **argv, int argc) {
if (!sway_assert(argc > 0, "argc should be positive")) {
return NULL;
}
int len = 0, i; int len = 0, i;
for (i = 0; i < argc; ++i) { for (i = 0; i < argc; ++i) {
len += strlen(argv[i]) + 1; len += strlen(argv[i]) + 1;

@ -61,6 +61,9 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
return cmd_results_new(CMD_INVALID, return cmd_results_new(CMD_INVALID,
"Missing background scaling mode."); "Missing background scaling mode.");
} }
if (j == 0) {
return cmd_results_new(CMD_INVALID, "Missing background file");
}
wordexp_t p = {0}; wordexp_t p = {0};
char *src = join_args(argv, j); char *src = join_args(argv, j);

Loading…
Cancel
Save