This commit is contained in:
qhy040404
2024-02-17 11:28:36 +08:00
parent 57c9531db8
commit 22251ca937

View File

@@ -134,11 +134,25 @@ internal static class DiscordController
// Actually requires a discord client to be running on Windows platform.
// If not, the following creation code will throw.
if (System.Diagnostics.Process.GetProcessesByName("Discord").Length <= 0)
System.Diagnostics.Process[] discordProcesses = System.Diagnostics.Process.GetProcessesByName("Discord");
if (discordProcesses.Length <= 0)
{
return;
}
foreach (System.Diagnostics.Process process in discordProcesses)
{
try
{
_ = process.Handle;
}
catch (Win32Exception)
{
return;
}
}
lock (SyncRoot)
{
DiscordCreateParams @params = default;