mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-23 04:45:40 +00:00
soundio_disconnect: allow NULL parameter
This commit is contained in:
parent
0887b1ee3d
commit
4a0b3579d4
|
@ -154,8 +154,6 @@ const char *soundio_backend_name(enum SoundIoBackend backend) {
|
||||||
|
|
||||||
void soundio_destroy(struct SoundIo *soundio) {
|
void soundio_destroy(struct SoundIo *soundio) {
|
||||||
SoundIoPrivate *si = (SoundIoPrivate *)soundio;
|
SoundIoPrivate *si = (SoundIoPrivate *)soundio;
|
||||||
if (!si)
|
|
||||||
return;
|
|
||||||
|
|
||||||
soundio_disconnect(soundio);
|
soundio_disconnect(soundio);
|
||||||
|
|
||||||
|
@ -238,6 +236,9 @@ int soundio_connect_backend(SoundIo *soundio, SoundIoBackend backend) {
|
||||||
void soundio_disconnect(struct SoundIo *soundio) {
|
void soundio_disconnect(struct SoundIo *soundio) {
|
||||||
SoundIoPrivate *si = (SoundIoPrivate *)soundio;
|
SoundIoPrivate *si = (SoundIoPrivate *)soundio;
|
||||||
|
|
||||||
|
if (!si)
|
||||||
|
return;
|
||||||
|
|
||||||
if (si->destroy)
|
if (si->destroy)
|
||||||
si->destroy(si);
|
si->destroy(si);
|
||||||
memset(&si->backend_data, 0, sizeof(SoundIoBackendData));
|
memset(&si->backend_data, 0, sizeof(SoundIoBackendData));
|
||||||
|
|
|
@ -49,6 +49,8 @@ static void test_create_outstream(void) {
|
||||||
soundio_outstream_destroy(outstream);
|
soundio_outstream_destroy(outstream);
|
||||||
soundio_device_unref(device);
|
soundio_device_unref(device);
|
||||||
soundio_destroy(soundio);
|
soundio_destroy(soundio);
|
||||||
|
soundio = NULL;
|
||||||
|
soundio_destroy(soundio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue