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

LibAudio: Make WavWriter check if a file was set during destruction

`WavWriter` can be constructed without a file, which should probably be
made impossible at some point. For now, let's not crash `Piano` when you
close the application.
This commit is contained in:
Jelle Raaijmakers 2023-04-25 15:01:00 +02:00 committed by Andreas Kling
parent 1c6c3685c4
commit 0f22dfa634

View file

@ -58,7 +58,7 @@ void WavWriter::finalize()
VERIFY(!m_finalized);
m_finalized = true;
if (m_file->is_open()) {
if (m_file && m_file->is_open()) {
auto result = [&]() -> ErrorOr<void> {
TRY(m_file->seek(0, SeekMode::SetPosition));
return TRY(write_header());