From 8c48e37c4f732b16610ff2aa76fb2fa74d4f7798 Mon Sep 17 00:00:00 2001 From: McSchneidar Date: Sun, 22 Feb 2026 18:57:23 +0100 Subject: [PATCH] Prevent crash on program close (null stream fix) (#838) * Fix Access Violation * Fix AccessViolation --- Vocaluxe/Lib/Sound/CPortAudioHandle.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs index a8fe8e89..d8ce237e 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioHandle.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioHandle.cs @@ -176,6 +176,11 @@ namespace Vocaluxe.Lib.Sound try { + if (stream == IntPtr.Zero) + { + CLog.Debug("Stream is null, skipping close."); + return; + } PortAudio.Pa_CloseStream(stream); } catch (Exception ex) @@ -235,4 +240,4 @@ namespace Vocaluxe.Lib.Sound return selectedHostApi; } } -} \ No newline at end of file +}