mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-27 06:33:21 -05:00
Merge pull request #876 from whatdoineed2do/multi-alsa-nickname-fix
[alsa] multi alsa cfg section SEGV with no nickname
This commit is contained in:
commit
04a43919a9
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user