aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/null.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-23 02:18:07 -0700
committerChris Robinson <[email protected]>2014-04-23 02:18:07 -0700
commit420599f8e37c8657fd1568aca3bcd5d1d4711234 (patch)
tree19207f0301003ec34bdba8caa6d6a6c93ebf48c2 /Alc/backends/null.c
parent7fed6383c017166e0db48b81b3eac1e996e96180 (diff)
Avoid using assert() in createBackend
Diffstat (limited to 'Alc/backends/null.c')
-rw-r--r--Alc/backends/null.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/Alc/backends/null.c b/Alc/backends/null.c
index 2c13a80f..c5a4c15f 100644
--- a/Alc/backends/null.c
+++ b/Alc/backends/null.c
@@ -212,15 +212,18 @@ static void ALCnullBackendFactory_probe(ALCnullBackendFactory* UNUSED(self), enu
static ALCbackend* ALCnullBackendFactory_createBackend(ALCnullBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type)
{
- ALCnullBackend *backend;
+ if(type == ALCbackend_Playback)
+ {
+ ALCnullBackend *backend;
- assert(type == ALCbackend_Playback);
+ backend = ALCnullBackend_New(sizeof(*backend));
+ if(!backend) return NULL;
+ memset(backend, 0, sizeof(*backend));
- backend = ALCnullBackend_New(sizeof(*backend));
- if(!backend) return NULL;
- memset(backend, 0, sizeof(*backend));
+ ALCnullBackend_Construct(backend, device);
- ALCnullBackend_Construct(backend, device);
+ return STATIC_CAST(ALCbackend, backend);
+ }
- return STATIC_CAST(ALCbackend, backend);
+ return NULL;
}