bluez5: don't crash when proxy is not created yet

We export a node and get a handle (of type ClientNode). The
session manager then later creates a proxy for the new object. We
can't assume the proxy is created yet when the device emits an
event so check for this.

This is a temporary bandaid. We should likely use get_node() to
create our own proxy for this purpose.

Fixes #552
This commit is contained in:
Wim Taymans 2021-01-09 20:07:32 +01:00
parent d87f838e09
commit 86576f1e63

View file

@ -249,7 +249,12 @@ static void bluez_device_event(void *data, const struct spa_event *event)
switch (type) {
case SPA_DEVICE_EVENT_ObjectConfig:
if (props)
/* FIXME, proxy might be NULL at this point until the
* node proxy is created. We should probably do
* pw_client_node_get_node() and perform the set_param on
* that node proxy instead of waiting for the session manager
* proxy. */
if (props != NULL && node->snode->obj.proxy != NULL)
pw_node_set_param((struct pw_node*)node->snode->obj.proxy,
SPA_PARAM_Props, 0, props);
break;