From 4a80a09db3c3a871f2825a2b7b7f1621ffab0f8b Mon Sep 17 00:00:00 2001 From: kevdliu <1766838+kevdliu@users.noreply.github.com> Date: Thu, 11 Jul 2024 17:32:31 -0400 Subject: [PATCH] Fix voice assistant crash when no speaker configured (#7075) --- esphome/components/voice_assistant/voice_assistant.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/voice_assistant/voice_assistant.cpp b/esphome/components/voice_assistant/voice_assistant.cpp index 8a8a9e92aa..e4f388db68 100644 --- a/esphome/components/voice_assistant/voice_assistant.cpp +++ b/esphome/components/voice_assistant/voice_assistant.cpp @@ -684,7 +684,9 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) { this->defer([this, text]() { this->tts_start_trigger_->trigger(text); #ifdef USE_SPEAKER - this->speaker_->start(); + if (this->speaker_ != nullptr) { + this->speaker_->start(); + } #endif }); break;