From f8e32f4a713a05b08cc55219cb9d5050c7889efd Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 22 Jun 2014 17:18:40 +0200 Subject: [PATCH] Just zero the buffer if we failed to open the file --- UI/BackgroundAudio.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index a7d51eaac0..da253314a6 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -104,8 +104,10 @@ public: bool IsOK() { return raw_data_ != 0; } void Read(short *buffer, int len) { - if (!raw_data_) + if (!raw_data_) { + memset(buffer, 0, len * 2 * sizeof(s16)); return; + } while (bgQueue.size() < len * 2) { int outBytes; decoder_->Decode(raw_data_ + raw_offset_, raw_bytes_per_frame_, (uint8_t *)buffer_, &outBytes);