mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-07-21 10:15:56 +00:00
When both input and output are disabled, UpdateDeviceState() sets dev_ to nullptr. Pressing a volume button calls SetOutputVolume() which previously called esp_codec_dev_set_out_vol(dev_, volume) without null-checking dev_, causing a crash via ESP_ERROR_CHECK. Fix: Add null guard for dev_ and mutex lock for thread safety. The volume is still saved via AudioCodec::SetOutputVolume() and will be applied when the device is reopened by UpdateDeviceState(). Agent-Logs-Url: https://github.com/78/xiaozhi-esp32/sessions/945c653a-ed16-49af-aefe-5cfb473402c6 Co-authored-by: 78 <4488133+78@users.noreply.github.com>