alsa, bluetooth: fail if user-requested profile doesn't exist

If we can't fulfill the user request fully, I think we shouldn't
fulfill it at all, to make it clear that the requested operation
didn't succeed.
This commit is contained in:
Tanu Kaskinen 2015-10-23 12:36:34 +03:00
parent 87f437d0dd
commit 59e76ca949
2 changed files with 14 additions and 4 deletions

View file

@ -807,8 +807,15 @@ int pa__init(pa_module *m) {
goto fail;
}
if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL)))
pa_card_new_data_set_profile(&data, profile);
if ((profile = pa_modargs_get_value(u->modargs, "profile", NULL))) {
if (pa_hashmap_get(data.profiles, profile))
pa_card_new_data_set_profile(&data, profile);
else {
pa_log("No such profile: %s", profile);
pa_card_new_data_done(&data);
goto fail;
}
}
u->card = pa_card_new(m->core, &data);
pa_card_new_data_done(&data);