From 661a506e76dd2910f4d92f2bff43990882d9152c Mon Sep 17 00:00:00 2001 From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:36:01 +0100 Subject: [PATCH] Fix crash when using the sync command --- HyperbolicDownloaderApi/Commands/HostCommands.cs | 2 +- HyperbolicDownloaderApi/Networking/HostsManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/HyperbolicDownloaderApi/Commands/HostCommands.cs b/HyperbolicDownloaderApi/Commands/HostCommands.cs index c3f83f9..875464f 100644 --- a/HyperbolicDownloaderApi/Commands/HostCommands.cs +++ b/HyperbolicDownloaderApi/Commands/HostCommands.cs @@ -211,7 +211,7 @@ public class HostCommands if (newHostsCount > 0) { - ApiManager.SendNotificationMessage($"Added {newHostsCount} new hosts)."); + ApiManager.SendNotificationMessage($"Added {newHostsCount} new host(s)."); } else { diff --git a/HyperbolicDownloaderApi/Networking/HostsManager.cs b/HyperbolicDownloaderApi/Networking/HostsManager.cs index f4b9082..f6f3d04 100644 --- a/HyperbolicDownloaderApi/Networking/HostsManager.cs +++ b/HyperbolicDownloaderApi/Networking/HostsManager.cs @@ -98,7 +98,7 @@ public class HostsManager { int newHostsCount = 0; - foreach (NetworkSocket host in hosts) + foreach (NetworkSocket host in hosts.ToArray()) { ApiManager.SendNotificationMessage($"{host.IPAddress}:{host.Port} > ???", NotificationMessageType.Warning); @@ -122,7 +122,7 @@ public class HostsManager } else { - ApiManager.SendNotificationMessageNewLine($"{host.IPAddress}:{host.Port} > No new host found", NotificationMessageType.Warning); + ApiManager.SendNotificationMessageNewLine($"{host.IPAddress}:{host.Port} > No new hosts found", NotificationMessageType.Warning); } host.LastActive = DateTime.Now;