From 9e0946111319d33649aedda3dba9ad2229648b5e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 23 Feb 2021 18:20:37 +0100 Subject: [PATCH] alsa: gracefully handle NULL params --- spa/plugins/alsa/alsa-acp-device.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-acp-device.c b/spa/plugins/alsa/alsa-acp-device.c index 342560c53..f7eb82f9d 100644 --- a/spa/plugins/alsa/alsa-acp-device.c +++ b/spa/plugins/alsa/alsa-acp-device.c @@ -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),