summaryrefslogtreecommitdiffstats
path: root/m_option.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-31 20:25:22 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-31 20:25:22 +0300
commitce112e0789b337490d686c80e76fc37f2a4bfe35 (patch)
treeb90228c124e3af21beb52abed82f7bdaef1cbbfa /m_option.c
parent9d25699c5831c5188968c8ed69d32a5d534b8ff6 (diff)
downloadmpv-ce112e0789b337490d686c80e76fc37f2a4bfe35.tar.bz2
mpv-ce112e0789b337490d686c80e76fc37f2a4bfe35.tar.xz
options: fix failure to parse trailing ',' in string list
A trailing separator in string list options was ignored after recent commit e873d703e9 ("options: change option parsing to use bstr"), which broke uses such as "-vo vdpau,". Fix.
Diffstat (limited to 'm_option.c')
-rw-r--r--m_option.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/m_option.c b/m_option.c
index 34b7cd7a99..a7321cb629 100644
--- a/m_option.c
+++ b/m_option.c
@@ -717,11 +717,13 @@ static int parse_str_list(const m_option_t *opt, struct bstr name,
char *ptr = str.start;
n = 0;
- while (str.len) {
+ while (1) {
struct bstr el = get_nextsep(&str, separator, 1);
res[n] = bstrdup0(NULL, el);
- str = bstr_cut(str, 1);
n++;
+ if (!str.len)
+ break;
+ str = bstr_cut(str, 1);
}
res[n] = NULL;
talloc_free(ptr);