From 67a24efb29bbfec16b8d9a248fc28df8bbbf1b87 Mon Sep 17 00:00:00 2001 From: Lefucjusz Date: Thu, 27 Jun 2024 10:52:10 +0200 Subject: [PATCH] [BH-2019] Fix crash after deleting WAV alarm sound Fix of the issue that the device would crash when entering alarm sound selection list after deleting selected file during alarm ringing, but only when file's format was WAV. --- module-audio/Audio/decoder/DecoderWAV.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module-audio/Audio/decoder/DecoderWAV.cpp b/module-audio/Audio/decoder/DecoderWAV.cpp index 0dc09cd9a..3414f9bb1 100644 --- a/module-audio/Audio/decoder/DecoderWAV.cpp +++ b/module-audio/Audio/decoder/DecoderWAV.cpp @@ -15,6 +15,10 @@ namespace audio { DecoderWAV::DecoderWAV(const std::string &filePath) : Decoder(filePath), wav(std::make_unique()) { + if (fileSize == 0) { + return; + } + if (drwav_init(wav.get(), drwavRead, drwavSeek, this, nullptr) == DRWAV_FALSE) { LOG_ERROR("Unable to init WAV decoder"); return;