diff --git a/main/audio_processing/afe_wake_word.cc b/main/audio_processing/afe_wake_word.cc index 77955970..cfd77986 100644 --- a/main/audio_processing/afe_wake_word.cc +++ b/main/audio_processing/afe_wake_word.cc @@ -35,6 +35,10 @@ void AfeWakeWord::Initialize(AudioCodec* codec) { int ref_num = codec_->input_reference() ? 1 : 0; srmodel_list_t *models = esp_srmodel_init("model"); + if (models == nullptr || models->num == -1) { + ESP_LOGE(TAG, "Failed to initialize wakenet model"); + return; + } for (int i = 0; i < models->num; i++) { ESP_LOGI(TAG, "Model %d: %s", i, models->model_name[i]); if (strstr(models->model_name[i], ESP_WN_PREFIX) != NULL) { diff --git a/main/audio_processing/esp_wake_word.cc b/main/audio_processing/esp_wake_word.cc index 17744d6a..c5d4ed32 100644 --- a/main/audio_processing/esp_wake_word.cc +++ b/main/audio_processing/esp_wake_word.cc @@ -27,7 +27,10 @@ void EspWakeWord::Initialize(AudioCodec* codec) { codec_ = codec; wakenet_model_ = esp_srmodel_init("model"); - + if (wakenet_model_ == nullptr || wakenet_model_->num == -1) { + ESP_LOGE(TAG, "Failed to initialize wakenet model"); + return; + } if(wakenet_model_->num > 1) { ESP_LOGW(TAG, "More than one model found, using the first one"); } else if (wakenet_model_->num == 0) {