sysaudio: fix crash on windows without a mic/capture device

This commit is contained in:
Andrew Gutekanst 2024-05-11 04:52:25 -04:00 committed by Stephen Gutekanst
parent f080a1c31e
commit 73a1ea4650

View file

@ -162,7 +162,9 @@ pub const Context = struct {
const default_playback_id = try ctx.getDefaultAudioEndpoint(.playback);
defer ctx.allocator.free(default_playback_id.?);
const default_capture_id = try ctx.getDefaultAudioEndpoint(.capture);
defer ctx.allocator.free(default_capture_id.?);
if (default_capture_id) |default_id| {
defer ctx.allocator.free(default_id);
}
// enumerate
var collection: ?*win32.IMMDeviceCollection = null;