mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
LibAudio: Make it so that an unused WavWriter is destructible
WavWriter::finalize didn't check that m_file was actually valid before trying to seek and close it. The file is only set by set_file, so it's not an invariant. Just add a null guard to finalize().
This commit is contained in:
parent
644f5ec160
commit
06865c78c7
Notes:
sideshowbarker
2024-07-19 00:18:03 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/06865c78c78 Pull-request: https://github.com/SerenityOS/serenity/pull/4683
1 changed files with 5 additions and 3 deletions
|
@ -70,9 +70,11 @@ void WavWriter::finalize()
|
|||
{
|
||||
ASSERT(!m_finalized);
|
||||
m_finalized = true;
|
||||
m_file->seek(0);
|
||||
write_header();
|
||||
m_file->close();
|
||||
if (m_file) {
|
||||
m_file->seek(0);
|
||||
write_header();
|
||||
m_file->close();
|
||||
}
|
||||
m_data_sz = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue