diff options
author | Amanieu d'Antras <amanieu@gmail.com> | 2013-12-09 15:59:05 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:37 +0100 |
commit | 22a29956b832cd1d74726b166c37c340df1a7213 (patch) | |
tree | ac5a05e2f0399819f7527e32e482559fc61cad23 /src | |
parent | 2e48ba43d27fd5b43c0ce32ebd795ae1cb69bc35 (diff) |
Fix crash in OpenAL when no input devices are available
Diffstat (limited to 'src')
-rw-r--r-- | src/client/snd_openal.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 25854dc8..549286c3 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -2686,11 +2686,14 @@ qboolean S_AL_Init( soundInterface_t *si ) defaultinputdevice = qalcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); // dump a list of available devices to a cvar for the user to see. - while((curlen = strlen(inputdevicelist))) + if (inputdevicelist) { - Q_strcat(inputdevicenames, sizeof(inputdevicenames), inputdevicelist); - Q_strcat(inputdevicenames, sizeof(inputdevicenames), "\n"); - inputdevicelist += curlen + 1; + while((curlen = strlen(inputdevicelist))) + { + Q_strcat(inputdevicenames, sizeof(inputdevicenames), inputdevicelist); + Q_strcat(inputdevicenames, sizeof(inputdevicenames), "\n"); + inputdevicelist += curlen + 1; + } } s_alAvailableInputDevices = Cvar_Get("s_alAvailableInputDevices", inputdevicenames, CVAR_ROM | CVAR_NORESTART); @@ -2699,7 +2702,7 @@ qboolean S_AL_Init( soundInterface_t *si ) // !!! FIXME: should probably open the capture device after // !!! FIXME: initializing Speex so we can change to wideband // !!! FIXME: if we like. - Com_Printf("OpenAL default capture device is '%s'\n", defaultinputdevice); + Com_Printf("OpenAL default capture device is '%s'\n", defaultinputdevice ? defaultinputdevice : "none"); alCaptureDevice = qalcCaptureOpenDevice(inputdevice, 8000, AL_FORMAT_MONO16, 4096); if( !alCaptureDevice && inputdevice ) { |