1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:07:43 +00:00

LibAudio/aplay: Handle WAV header errors properly

We shouldn't just ASSERT() if the header parse fails. This was crashing
Piano completely.
This commit is contained in:
William McPherson 2020-02-10 01:53:10 +11:00 committed by Andreas Kling
parent 4ad96df0d4
commit d55d2b2794
2 changed files with 7 additions and 2 deletions

View file

@ -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 {}; \