[vlc-commits] ALSA: device description may be NULL
Rémi Denis-Courmont
git at videolan.org
Sat Apr 9 16:07:53 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 9 17:07:39 2011 +0300| [b411b318ea6e58259c649c59d86426584685cd76] | committer: Rémi Denis-Courmont
ALSA: device description may be NULL
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b411b318ea6e58259c649c59d86426584685cd76
---
modules/audio_output/alsa.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index ed72dc3..a67d971 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -942,13 +942,14 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item)
{
void *hint = hints[i];
char *name = snd_device_name_get_hint(hint, "NAME");
- char *desc = snd_device_name_get_hint(hint, "DESC");
-
- for (char *lf = strchr(desc, '\n'); lf; lf = strchr(lf, '\n'))
- *lf = ' ';
+ if (unlikely(name == NULL))
+ continue;
- if (likely(desc != NULL && name != NULL))
- msg_Dbg(obj, " %s (%s)", desc, name);
+ char *desc = snd_device_name_get_hint(hint, "DESC");
+ if (desc != NULL)
+ for (char *lf = strchr(desc, '\n'); lf; lf = strchr(lf, '\n'))
+ *lf = ' ';
+ msg_Dbg(obj, " %s (%s)", (desc != NULL) ? desc : name, name);
if (item != NULL)
{
@@ -957,6 +958,8 @@ static void GetDevices (vlc_object_t *obj, module_config_t *item)
item->ppsz_list_text = xrealloc(item->ppsz_list_text,
(item->i_list + 2) * sizeof(char *));
item->ppsz_list[item->i_list] = name;
+ if (desc == NULL)
+ desc = strdup(name);
item->ppsz_list_text[item->i_list] = desc;
item->i_list++;
}
More information about the vlc-commits
mailing list