aboutsummaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 3eea498..e4086b1 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -283,7 +283,9 @@ int sound_device_get_by_name(SoundDevice *device, const char *device_name, const
}
void sound_device_close(SoundDevice *device) {
- pa_sound_device_free((pa_handle*)device->handle);
+ if(device->handle)
+ pa_sound_device_free((pa_handle*)device->handle);
+ device->handle = NULL;
}
int sound_device_read_next_chunk(SoundDevice *device, void **buffer) {