diff options
author | Chris Robinson <[email protected]> | 2014-04-23 02:18:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-23 02:18:07 -0700 |
commit | 420599f8e37c8657fd1568aca3bcd5d1d4711234 (patch) | |
tree | 19207f0301003ec34bdba8caa6d6a6c93ebf48c2 /Alc/backends/loopback.c | |
parent | 7fed6383c017166e0db48b81b3eac1e996e96180 (diff) |
Avoid using assert() in createBackend
Diffstat (limited to 'Alc/backends/loopback.c')
-rw-r--r-- | Alc/backends/loopback.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Alc/backends/loopback.c b/Alc/backends/loopback.c index d509313a..505dfacf 100644 --- a/Alc/backends/loopback.c +++ b/Alc/backends/loopback.c @@ -121,15 +121,18 @@ static void ALCloopbackFactory_probe(ALCloopbackFactory* UNUSED(self), enum DevP static ALCbackend* ALCloopbackFactory_createBackend(ALCloopbackFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) { - ALCloopback *backend; + if(type == ALCbackend_Loopback) + { + ALCloopback *backend; - assert(type == ALCbackend_Loopback); + backend = ALCloopback_New(sizeof(*backend)); + if(!backend) return NULL; + memset(backend, 0, sizeof(*backend)); - backend = ALCloopback_New(sizeof(*backend)); - if(!backend) return NULL; - memset(backend, 0, sizeof(*backend)); + ALCloopback_Construct(backend, device); - ALCloopback_Construct(backend, device); + return STATIC_CAST(ALCbackend, backend); + } - return STATIC_CAST(ALCbackend, backend); + return NULL; } |