[pulseaudio-discuss] [PATCH] add judgment logic before pa_streq

Tanu Kaskinen tanuk at iki.fi
Fri Jul 1 14:59:18 UTC 2022


On Thu, 2022-06-30 at 16:23 +0800, lishengyu wrote:
> ---
>  src/modules/module-switch-on-port-available.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c
> index de9c87092..53c5a0b32 100644
> --- a/src/modules/module-switch-on-port-available.c
> +++ b/src/modules/module-switch-on-port-available.c
> @@ -393,6 +393,9 @@ static pa_hook_result_t card_profile_available_hook_callback(pa_core *c, pa_card
>      if (profile->available != PA_AVAILABLE_NO)
>          return PA_HOOK_OK;
>  
> +    if (!card->active_profile)
> +        return PA_HOOK_OK;
> +
>      if (!pa_streq(profile->name, card->active_profile->name))
>          return PA_HOOK_OK;
>  

Thanks for the patch! Before applying it I would like to know how
active_profile could possibly be NULL here, though. If a card has any
profiles, one of them has to be active.

PS. The best way to submit patch is by making a merge request on
GitLab, https://gitlab.freedesktop.org/pulseaudio/pulseaudio

-- Tanu



More information about the pulseaudio-discuss mailing list