Skip to content

Commit d4894a0

Browse files
committed
fix(Switching): Possible crash when trying to switch audio of process that just closed.
Fixes SOUNDSWITCH-C4 Fixes SOUNDSWITCH-C3
1 parent 1bd6c28 commit d4894a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

SoundSwitch.Audio.Manager/AudioSwitcher.cs

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ public void SwitchProcessTo(string deviceId, ERole role, EDataFlow flow, uint pr
114114
var process = Process.GetProcessById((int)processId);
115115
processName = process.ProcessName;
116116
}
117+
catch (InvalidOperationException e)
118+
{
119+
Trace.TraceInformation($"Attempt to switch [{processId}] but got exception: {e}");
120+
return;
121+
}
117122
catch (Exception e)
118123
{
119124
Trace.TraceError($"Can't get process info: {e}");

0 commit comments

Comments
 (0)