From 1972bf97dbdbe1595faa6e57facd9ead9765a7b4 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Fri, 22 Jul 2011 16:43:27 +0000 Subject: [PATCH] Fix client crash on windows with old OpenAL --- code/client/snd_openal.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index 0eaff447..e48d1f28 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -2410,7 +2410,7 @@ qboolean S_AL_Init( soundInterface_t *si ) int curlen; // get all available devices + the default device name. - if(enumeration_ext) + if(enumeration_all_ext) { devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); @@ -2428,18 +2428,24 @@ qboolean S_AL_Init( soundInterface_t *si ) // Generic Software as that one works more reliably with various sound systems. // If it's not, use OpenAL's default selection as we don't want to ignore // native hardware acceleration. - if(!device && !strcmp(defaultdevice, "Generic Hardware")) + if(!device && defaultdevice && !strcmp(defaultdevice, "Generic Hardware")) device = "Generic Software"; #endif // dump a list of available devices to a cvar for the user to see. - while((curlen = strlen(devicelist))) - { - Q_strcat(devicenames, sizeof(devicenames), devicelist); - Q_strcat(devicenames, sizeof(devicenames), "\n"); - devicelist += curlen + 1; + if(devicelist) + { + while((curlen = strlen(devicelist))) + { + Q_strcat(devicenames, sizeof(devicenames), devicelist); + Q_strcat(devicenames, sizeof(devicenames), "\n"); + + devicelist += curlen + 1; + } } + else + devicelist = ""; s_alAvailableDevices = Cvar_Get("s_alAvailableDevices", devicenames, CVAR_ROM | CVAR_NORESTART); }