[i2s_audio] Check for a nullptr before disabling and deleting channel (#9062)

This commit is contained in:
Kevin Ahrendt 2025-06-15 22:19:50 +01:00 committed by GitHub
parent be58cdda3b
commit bd85ba9b6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -317,6 +317,7 @@ void I2SAudioMicrophone::stop_driver_() {
ESP_LOGW(TAG, "Error uninstalling I2S driver - it may not have started: %s", esp_err_to_name(err));
}
#else
if (this->rx_handle_ != nullptr) {
/* Have to stop the channel before deleting it */
err = i2s_channel_disable(this->rx_handle_);
if (err != ESP_OK) {
@ -327,6 +328,8 @@ void I2SAudioMicrophone::stop_driver_() {
if (err != ESP_OK) {
ESP_LOGW(TAG, "Error deleting I2S channel - it may not have started: %s", esp_err_to_name(err));
}
this->rx_handle_ = nullptr;
}
#endif
this->parent_->unlock();
}