Make sure there's a valid backend before trying to open a device

This commit is contained in:
Chris Robinson 2011-08-19 02:55:36 -07:00
parent e8e1286572
commit 711f0a29ec

View File

@ -1635,6 +1635,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName,
DO_INITCONFIG();
if(!CaptureBackend.name)
{
alcSetError(NULL, ALC_INVALID_VALUE);
return NULL;
}
if(SampleSize <= 0)
{
alcSetError(NULL, ALC_INVALID_VALUE);
@ -2690,6 +2696,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
DO_INITCONFIG();
if(!PlaybackBackend.name)
{
alcSetError(NULL, ALC_INVALID_VALUE);
return NULL;
}
if(deviceName && (!deviceName[0] || strcasecmp(deviceName, "openal soft") == 0 || strcasecmp(deviceName, "openal-soft") == 0))
deviceName = NULL;