f434087e42b introduced the potential to not select a card profile if
all the profiles were marked as unavailable.
While this is very unlikely, it's a theoretical posibility, so if the
initial choice of a profile fails, try harder.
if (!c->active_profile || profile->priority > c->active_profile->priority)
c->active_profile = profile;
}
+ /* If all profiles are not available, then we still need to pick one */
+ if (!c->active_profile) {
+ PA_HASHMAP_FOREACH(profile, c->profiles, state)
+ if (!c->active_profile || profile->priority > c->active_profile->priority)
+ c->active_profile = profile;
+ }
pa_assert(c->active_profile);
}