diff options
author | William McPherson <willmcpherson2@gmail.com> | 2020-02-10 01:53:10 +1100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-10 14:04:27 +0100 |
commit | d55d2b279460ee106b47602dbc10812ab9eed2eb (patch) | |
tree | 74c322619724f55d2b1feaa6d2b3eed4d3b37950 /Libraries/LibAudio/WavLoader.cpp | |
parent | 4ad96df0d4708e08cbe21b6964766a630e3f6426 (diff) | |
download | serenity-d55d2b279460ee106b47602dbc10812ab9eed2eb.zip |
LibAudio/aplay: Handle WAV header errors properly
We shouldn't just ASSERT() if the header parse fails. This was crashing
Piano completely.
Diffstat (limited to 'Libraries/LibAudio/WavLoader.cpp')
-rw-r--r-- | Libraries/LibAudio/WavLoader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Libraries/LibAudio/WavLoader.cpp b/Libraries/LibAudio/WavLoader.cpp index e100e8f7e7..8412c4eda0 100644 --- a/Libraries/LibAudio/WavLoader.cpp +++ b/Libraries/LibAudio/WavLoader.cpp @@ -40,7 +40,9 @@ WavLoader::WavLoader(const StringView& path) return; } - parse_header(); + if (!parse_header()) + return; + m_resampler = make<ResampleHelper>(m_sample_rate, 44100); } @@ -81,7 +83,6 @@ bool WavLoader::parse_header() #define CHECK_OK(msg) \ do { \ - ASSERT(ok); \ if (stream.handle_read_failure()) { \ m_error_string = String::format("Premature stream EOF at %s", msg); \ return {}; \ |