From 7ca568db8691482f7d3dc1047d2749dd07cc2783 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Fri, 8 Jan 2021 22:26:46 +0200 Subject: [PATCH] bluez5: don't crash if validate_config fails transport->device_link has to be set when transport->device is not NULL --- spa/plugins/bluez5/bluez5-dbus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index bb85316cf..32a7076ca 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -1187,6 +1187,13 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn, transport->a2dp_codec = codec; transport_update_props(transport, &it[1], NULL); + if (transport->device == NULL) { + spa_log_warn(monitor->log, "no device found for transport"); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + if (is_new) + spa_list_append(&transport->device->transport_list, &transport->device_link); + if (codec->validate_config) { struct spa_audio_info info; if (codec->validate_config(codec, 0, @@ -1206,13 +1213,6 @@ static DBusHandlerResult endpoint_set_configuration(DBusConnection *conn, spa_log_info(monitor->log, "%p: %s validate conf channels:%d", monitor, path, transport->n_channels); - if (transport->device == NULL) { - spa_log_warn(monitor->log, "no device found for transport"); - return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; - } - if (is_new) - spa_list_append(&transport->device->transport_list, &transport->device_link); - spa_bt_device_connect_profile(transport->device, transport->profile); if ((r = dbus_message_new_method_return(m)) == NULL)