alsa: gracefully handle NULL params

This commit is contained in:
Wim Taymans 2021-02-23 18:20:37 +01:00
parent 1f2cb7ac67
commit 9e09461113

View file

@ -609,7 +609,10 @@ static int impl_set_param(void *object,
uint32_t id;
bool save = false;
if ((res = spa_pod_parse_object(param,
if (param == NULL) {
id = acp_card_find_best_profile_index(this->card, NULL);
save = true;
} else if ((res = spa_pod_parse_object(param,
SPA_TYPE_OBJECT_ParamProfile, NULL,
SPA_PARAM_PROFILE_index, SPA_POD_Int(&id),
SPA_PARAM_PROFILE_save, SPA_POD_OPT_Bool(&save))) < 0) {
@ -629,6 +632,9 @@ static int impl_set_param(void *object,
struct acp_device *dev;
bool save = false;
if (param == NULL)
return -EINVAL;
if ((res = spa_pod_parse_object(param,
SPA_TYPE_OBJECT_ParamRoute, NULL,
SPA_PARAM_ROUTE_index, SPA_POD_Int(&id),