avoid following NULL pointers

This commit is contained in:
Wim Taymans 2020-05-20 13:41:48 +02:00
parent a898f21c87
commit a19bab4b16
5 changed files with 25 additions and 20 deletions

View file

@ -430,8 +430,8 @@ static int rescan_endpoint(struct impl *impl, struct endpoint *ep)
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
if (strcmp(obj->type, PW_TYPE_INTERFACE_Endpoint) == 0) {
peer = sm_object_get_data(obj, SESSION_KEY);
goto do_link;
if ((peer = sm_object_get_data(obj, SESSION_KEY)) != NULL)
goto do_link;
}
else if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
node = (struct sm_node*)obj;

View file

@ -490,7 +490,8 @@ static void object_update(void *data)
node->obj->obj.avail & SM_OBJECT_CHANGE_MASK_PROPERTIES)
node->endpoint = create_endpoint(node);
if (node->obj->obj.changed & SM_NODE_CHANGE_MASK_PARAMS)
if (node->endpoint &&
node->obj->obj.changed & SM_NODE_CHANGE_MASK_PARAMS)
update_params(node->endpoint);
}

View file

@ -239,11 +239,10 @@ new_node (GstPipeWireDeviceProvider *self, struct node_data *data)
gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL);
klass = spa_dict_lookup (info->props, PW_KEY_MEDIA_CLASS);
name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION);
}
if (klass == NULL)
klass = "unknown/unknown";
name = spa_dict_lookup (info->props, PW_KEY_NODE_DESCRIPTION);
if (name == NULL)
name = "unknown";

View file

@ -806,17 +806,19 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
n_items = props ? props->n_items : 0;
parent_id = 0;
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
if ((str = spa_dict_lookup(props, "node.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
if ((str = spa_dict_lookup(props, "device.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Device) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
if ((str = spa_dict_lookup(props, "module.id")) != NULL)
parent_id = atoi(str);
if (props) {
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
if ((str = spa_dict_lookup(props, "node.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
if ((str = spa_dict_lookup(props, "device.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Device) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
if ((str = spa_dict_lookup(props, "module.id")) != NULL)
parent_id = atoi(str);
}
}
version = 0;