don't hit an assert when we cannot resume a device
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Aug 2007 17:52:13 +0000 (17:52 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Aug 2007 17:52:13 +0000 (17:52 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1599 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/modules/module-alsa-sink.c
src/modules/module-alsa-source.c

index 708dd1f..1a69954 100644 (file)
@@ -337,8 +337,10 @@ static int unsuspend(struct userdata *u) {
     return 0;
 
 fail:
-    snd_pcm_close(u->pcm_handle);
-    u->pcm_handle = NULL;
+    if (u->pcm_handle) {
+        snd_pcm_close(u->pcm_handle);
+        u->pcm_handle = NULL;
+    }
 
     return -1;
 }
index 61035c7..553d028 100644 (file)
@@ -325,8 +325,10 @@ static int unsuspend(struct userdata *u) {
     return 0;
 
 fail:
-    snd_pcm_close(u->pcm_handle);
-    u->pcm_handle = NULL;
+    if (u->pcm_handle) {
+        snd_pcm_close(u->pcm_handle);
+        u->pcm_handle = NULL;
+    }
 
     return -1;
 }