diff --git a/BloonsTD6 Mod Helper/Patches/Player/NKMultiConnection_Receive.cs b/BloonsTD6 Mod Helper/Patches/Player/NKMultiConnection_Receive.cs index 4bf06382c..32cb8aea5 100644 --- a/BloonsTD6 Mod Helper/Patches/Player/NKMultiConnection_Receive.cs +++ b/BloonsTD6 Mod Helper/Patches/Player/NKMultiConnection_Receive.cs @@ -12,8 +12,9 @@ internal static void Postfix(NKMultiConnection __instance) var messageQueue = __instance.ReceiveQueue; if (messageQueue == null || messageQueue.Count == 0) return; - - for (int i = 0; i < messageQueue.Count; i++) + + var messageCount = messageQueue.Count; + for (int i = 0; i < messageCount; i++) { var message = messageQueue.Dequeue(); bool consumed = false; @@ -28,5 +29,4 @@ internal static void Postfix(NKMultiConnection __instance) } } } - } \ No newline at end of file