Skip to content

Commit

Permalink
audio: add NULL check for SR recorder
Browse files Browse the repository at this point in the history
If the SR recorder cannot be created for some reason, we currently just
print "Ready!" on the display. Improve UX by informing the user about
the problem.
  • Loading branch information
stintel committed Jan 9, 2024
1 parent 12010c1 commit 6b7857e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,13 @@ static esp_err_t start_rec(void)
}
free(audio_codec);
free(wake_word);

if (cfg_ar.sr_handle == NULL) {
ESP_LOGE(TAG, "failed to init SR recorder");
ui_pr_err("Recorder init failed", "Check logs");
return ESP_FAIL;
}

hdl_ar = audio_recorder_create(&cfg_ar);

return ret;
Expand Down

0 comments on commit 6b7857e

Please sign in to comment.