From f691afcc419bca1439d0051c500e0acfa5142c8f Mon Sep 17 00:00:00 2001 From: Dominic Clark Date: Thu, 5 Oct 2023 18:41:00 +0100 Subject: [PATCH] Fix loading samples unsupported by libsndfile (#6918) --- src/core/SampleBuffer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/SampleBuffer.cpp b/src/core/SampleBuffer.cpp index c96111bba45..f583067f8a4 100644 --- a/src/core/SampleBuffer.cpp +++ b/src/core/SampleBuffer.cpp @@ -305,10 +305,6 @@ void SampleBuffer::update(bool keepSettings) } sf_close(sndFile); } - else - { - fileLoadError = FileLoadError::Invalid; - } f.close(); } @@ -337,6 +333,11 @@ void SampleBuffer::update(bool keepSettings) { m_frames = decodeSampleDS(file, buf, channels, samplerate); } + + if (m_frames == 0) + { + fileLoadError = FileLoadError::Invalid; + } } if (m_frames == 0 || fileLoadError != FileLoadError::None) // if still no frames, bail