diff options
author | nicm <nicm> | 2017-01-25 23:50:51 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-01-25 23:50:51 +0000 |
commit | 776ce8a9d5a30bd4a8aab59c5152e78774bb805c (patch) | |
tree | 1e05285dce815c5ce6d4a771209455525fcfbe98 | |
parent | 163732e89fafdef6e4b38f7584336611b2135092 (diff) | |
download | rtmux-776ce8a9d5a30bd4a8aab59c5152e78774bb805c.tar.gz rtmux-776ce8a9d5a30bd4a8aab59c5152e78774bb805c.tar.bz2 rtmux-776ce8a9d5a30bd4a8aab59c5152e78774bb805c.zip |
Clear option before adding to array if no -a, reported by Michael
Nickerson.
-rw-r--r-- | cmd-set-option.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c index f7e6b730..c7cef42c 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -211,9 +211,11 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item) } if (o == NULL) o = options_empty(oo, options_table_entry(parent)); - if (idx == -1) + if (idx == -1) { + if (!append) + options_array_clear(o); options_array_assign(o, value); - else if (options_array_set(o, idx, value, append) != 0) { + } else if (options_array_set(o, idx, value, append) != 0) { cmdq_error(item, "invalid index: %s", args->argv[0]); return (CMD_RETURN_ERROR); } |