mirror of https://github.com/encounter/SDL.git
alsa: Make device enumeration robust against weird results with NULL strings.
This commit is contained in:
parent
6cfa71a10e
commit
a581346fae
|
@ -668,12 +668,17 @@ ALSA_Deinitialize(void)
|
||||||
static void
|
static void
|
||||||
add_device(const int iscapture, const char *name, const char *_desc)
|
add_device(const int iscapture, const char *name, const char *_desc)
|
||||||
{
|
{
|
||||||
char *desc = SDL_strdup(_desc);
|
char *desc = NULL;
|
||||||
char *handle = NULL;
|
char *handle = NULL;
|
||||||
char *ptr;
|
char *ptr = NULL;
|
||||||
|
|
||||||
|
if (!name || !_desc) {
|
||||||
|
return; /* nothing we can do with this...? */
|
||||||
|
}
|
||||||
|
|
||||||
|
desc = SDL_strdup(_desc);
|
||||||
if (!desc) {
|
if (!desc) {
|
||||||
return;
|
return; /* oh well, out of memory. Skip it. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output" */
|
/* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output" */
|
||||||
|
|
Loading…
Reference in New Issue