summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibAudio
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-04-25 15:01:00 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-25 15:34:14 +0200
commit0f22dfa634a29880b2eb16cc8054939b7c47b8c0 (patch)
treef691cc144ccc9ea213a8bc2dfd42333b432eb44f /Userland/Libraries/LibAudio
parent1c6c3685c4c51000dd2397748db59177d2474688 (diff)
downloadserenity-0f22dfa634a29880b2eb16cc8054939b7c47b8c0.zip
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.
Diffstat (limited to 'Userland/Libraries/LibAudio')
-rw-r--r--Userland/Libraries/LibAudio/WavWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp
index 896ec15719..7930c6a9ca 100644
--- a/Userland/Libraries/LibAudio/WavWriter.cpp
+++ b/Userland/Libraries/LibAudio/WavWriter.cpp
@@ -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());