From df30b217d9551749e02373b66bddd2f8787223cf Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 20 Feb 2017 22:46:48 -0800 Subject: ao: never set ao->device = "" For example, previously, --audio-device='alsa/' would provide ao->device="" to the alsa driver in spite of the fact that this is an already parsed option. To avoid requiring a check of ao->device[0] in every driver, make sure this never happens. --- audio/out/ao.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/audio/out/ao.c b/audio/out/ao.c index e643945ec7..32140b2b34 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -245,9 +245,10 @@ static void split_ao_device(void *tmp, char *opt, char **out_ao, char **out_dev) return; if (!opt[0] || strcmp(opt, "auto") == 0) return; - // Split on "/". If there's no "/", leave out_device NULL. + // Split on "/". If "/" is the final character, or absent, out_dev is NULL. bstr b_dev, b_ao; - if (bstr_split_tok(bstr0(opt), "/", &b_ao, &b_dev)) + bstr_split_tok(bstr0(opt), "/", &b_ao, &b_dev); + if (b_dev.len > 0) *out_dev = bstrto0(tmp, b_dev); *out_ao = bstrto0(tmp, b_ao); } -- cgit v1.2.3