spa: alsa: Add a NULL check before updating rate match

The RateMatch IO might be NULL for the driver, and trying to update rate
matching with state->rate_match crashes in this case.
This commit is contained in:
Arun Raghavan 2024-12-05 13:08:04 -05:00
parent 35dbaa840b
commit 5cbf3654c7
2 changed files with 4 additions and 2 deletions

View file

@ -757,7 +757,8 @@ impl_node_port_set_io(void *object,
break;
case SPA_IO_RateMatch:
this->rate_match = data;
spa_alsa_update_rate_match(this);
if (this->rate_match)
spa_alsa_update_rate_match(this);
break;
default:
return -ENOENT;

View file

@ -687,7 +687,8 @@ impl_node_port_set_io(void *object,
break;
case SPA_IO_RateMatch:
this->rate_match = data;
spa_alsa_update_rate_match(this);
if (this->rate_match)
spa_alsa_update_rate_match(this);
break;
default:
return -ENOENT;