fix nullptr error

This commit is contained in:
Terrence
2025-04-09 08:24:02 +08:00
parent 9e0de3b302
commit 69540c6551
2 changed files with 6 additions and 2 deletions

View File

@@ -78,8 +78,10 @@ void AudioProcessor::Start() {
void AudioProcessor::Stop() { void AudioProcessor::Stop() {
xEventGroupClearBits(event_group_, PROCESSOR_RUNNING); xEventGroupClearBits(event_group_, PROCESSOR_RUNNING);
if (afe_data_ != nullptr) {
afe_iface_->reset_buffer(afe_data_); afe_iface_->reset_buffer(afe_data_);
} }
}
bool AudioProcessor::IsRunning() { bool AudioProcessor::IsRunning() {
return xEventGroupGetBits(event_group_) & PROCESSOR_RUNNING; return xEventGroupGetBits(event_group_) & PROCESSOR_RUNNING;

View File

@@ -83,8 +83,10 @@ void WakeWordDetect::StartDetection() {
void WakeWordDetect::StopDetection() { void WakeWordDetect::StopDetection() {
xEventGroupClearBits(event_group_, DETECTION_RUNNING_EVENT); xEventGroupClearBits(event_group_, DETECTION_RUNNING_EVENT);
if (afe_data_ != nullptr) {
afe_iface_->reset_buffer(afe_data_); afe_iface_->reset_buffer(afe_data_);
} }
}
bool WakeWordDetect::IsDetectionRunning() { bool WakeWordDetect::IsDetectionRunning() {
return xEventGroupGetBits(event_group_) & DETECTION_RUNNING_EVENT; return xEventGroupGetBits(event_group_) & DETECTION_RUNNING_EVENT;