card: Don't crash if someone gives NULL name to pa_card_set_profile().

In my opinion, pa_card_set_profile() should assert that name
is not NULL, and it would be the job of the client interface
to filter out NULLs from the client input, but this is done
this way also when setting sink and source ports, so for
consistency I'll do this this way for now.
This commit is contained in:
Tanu Kaskinen 2012-06-08 19:36:45 +03:00
parent 5f62cf8f40
commit 21c6c70438

View file

@ -228,7 +228,7 @@ int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save) {
return -PA_ERR_NOTIMPLEMENTED;
}
if (!c->profiles)
if (!c->profiles || !name)
return -PA_ERR_NOENTITY;
if (!(profile = pa_hashmap_get(c->profiles, name)))