mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:27:43 +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);
|
ASSERT(!m_finalized);
|
||||||
m_finalized = true;
|
m_finalized = true;
|
||||||
m_file->seek(0);
|
if (m_file) {
|
||||||
write_header();
|
m_file->seek(0);
|
||||||
m_file->close();
|
write_header();
|
||||||
|
m_file->close();
|
||||||
|
}
|
||||||
m_data_sz = 0;
|
m_data_sz = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue