raop: Don't crash if fd is not open when trying to close it
authorDavid Henningsson <david.henningsson@canonical.com>
Mon, 12 Sep 2011 09:23:57 +0000 (11:23 +0200)
committerColin Guthrie <colin@mageia.org>
Wed, 14 Sep 2011 08:23:38 +0000 (09:23 +0100)
BugLink: http://bugs.launchpad.net/bugs/845286
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/modules/raop/module-raop-sink.c

index 422f05c..2cb7a95 100644 (file)
@@ -235,10 +235,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
         }
 
         case SINK_MESSAGE_RIP_SOCKET: {
-            pa_assert(u->fd >= 0);
-
-            pa_close(u->fd);
-            u->fd = -1;
+            if (u->fd >= 0) {
+                pa_close(u->fd);
+                u->fd = -1;
+            } else
+                /* FIXME */
+                pa_log("We should not get to this state. Cannot rip socket if not connected.");
 
             if (u->sink->thread_info.state == PA_SINK_SUSPENDED) {