stream: don't crash when _set_control is given 0 values

This commit is contained in:
Wim Taymans 2023-03-31 11:28:28 +02:00
parent bed961a4b2
commit 0873c6942a

View file

@ -2135,8 +2135,9 @@ int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_valu
pw_log_debug("%p: set control %d %d %f", stream, id, n_values, values[0]); pw_log_debug("%p: set control %d %d %f", stream, id, n_values, values[0]);
if ((c = find_control(stream, id))) { if ((c = find_control(stream, id))) {
uint32_t container = n_values > 0 ? c->container : SPA_TYPE_None;
spa_pod_builder_prop(&b, id, 0); spa_pod_builder_prop(&b, id, 0);
switch (c->container) { switch (container) {
case SPA_TYPE_Float: case SPA_TYPE_Float:
spa_pod_builder_float(&b, values[0]); spa_pod_builder_float(&b, values[0]);
break; break;