diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index cd539a6b0a33d9ddd9bf84d9acbc4d449d41b118..83f2932e9bf027a65f3f59930912c6f78bb12111 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -257,6 +257,17 @@ static const char *transport_state_to_string(pa_bluetooth_transport_state_t stat bool pa_bluetooth_device_supports_profile(const pa_bluetooth_device *device, pa_bluetooth_profile_t profile) { bool show_hfp, show_hsp, r; + pa_assert(device); + + /* While discovery is being released adapters will be removed from devices, + * and there are no profiles to support without adapter. + */ + if (!device->adapter) { + pa_log_debug("Device %s (%s) has no adapter to support profile %s", + device->alias, device->address, pa_bluetooth_profile_to_string(profile)); + return false; + } + if (device->enable_hfp_hf) { show_hfp = pa_hashmap_get(device->uuids, PA_BLUETOOTH_UUID_HFP_HF); show_hsp = !show_hfp;