mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00: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
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
Add a link
Reference in a new issue