From 609cba5f049be9f391f27649d5dba21b36a74918 Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Mon, 6 Jan 2020 15:38:32 +0000 Subject: [PATCH] [alsa] multi alsa cfg section SEGV with no nickname - use 'card' when not specified --- src/outputs/alsa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/outputs/alsa.c b/src/outputs/alsa.c index 563d33ff..29326e4c 100644 --- a/src/outputs/alsa.c +++ b/src/outputs/alsa.c @@ -1188,13 +1188,13 @@ alsa_device_add(cfg_t* cfg_audio, int id) { struct output_device *device; struct alsa_extra *ae; + const char *nickname; int ret; CHECK_NULL(L_LAUDIO, device = calloc(1, sizeof(struct output_device))); CHECK_NULL(L_LAUDIO, ae = calloc(1, sizeof(struct alsa_extra))); device->id = id; - device->name = strdup(cfg_getstr(cfg_audio, "nickname")); device->type = OUTPUT_TYPE_ALSA; device->type_name = outputs_name(device->type); device->extra_device_info = ae; @@ -1205,6 +1205,9 @@ alsa_device_add(cfg_t* cfg_audio, int id) if (!ae->card_name) ae->card_name = cfg_getstr(cfg_audio, "card"); + nickname = cfg_getstr(cfg_audio, "nickname"); + device->name = strdup(nickname ? nickname : ae->card_name); + ae->mixer_name = cfg_getstr(cfg_audio, "mixer"); ae->mixer_device_name = cfg_getstr(cfg_audio, "mixer_device"); if (!ae->mixer_device_name || strlen(ae->mixer_device_name) == 0)