From 3336e955865a078f5d4d1099de79353cde5fee0c Mon Sep 17 00:00:00 2001 From: lidgren Date: Fri, 9 Dec 2011 09:16:10 +0000 Subject: [PATCH] Avoid throwing exception in SendToAll when no connections --- Lidgren.Network/NetServer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lidgren.Network/NetServer.cs b/Lidgren.Network/NetServer.cs index cae9765..cd7cd89 100644 --- a/Lidgren.Network/NetServer.cs +++ b/Lidgren.Network/NetServer.cs @@ -24,7 +24,11 @@ namespace Lidgren.Network /// How to deliver the message public void SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method) { - SendMessage(msg, this.Connections, method, 0); + var all = this.Connections; + if (all.Count <= 0) + return; + + SendMessage(msg, all, method, 0); } ///