bluetooth: Fix check if transport exists before acquire
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 31 Aug 2012 10:50:59 +0000 (12:50 +0200)
committerJaska Uimonen <jaska.uimonen@intel.com>
Thu, 24 Jan 2013 07:29:36 +0000 (09:29 +0200)
The transport might have disapeared exactly before acquiring, so we
should avoid an assertion failure, in this case inside the function
pa_bluetooth_discovery_get_by_path().

src/modules/bluetooth/module-bluetooth-device.c

index c83fc80..8da0d7e 100644 (file)
@@ -326,6 +326,11 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t start) {
     const char *accesstype = "rw";
     const pa_bluetooth_transport *t;
 
+    if (u->transport == NULL) {
+        pa_log("Transport no longer available.");
+        return -1;
+    }
+
     if (bt_transport_is_acquired(u)) {
         if (start)
             goto done;