diff --git a/ChatSharp/IrcClient.Commands.cs b/ChatSharp/IrcClient.Commands.cs index fd8818b..36551e0 100644 --- a/ChatSharp/IrcClient.Commands.cs +++ b/ChatSharp/IrcClient.Commands.cs @@ -20,7 +20,7 @@ namespace ChatSharp public void SendMessage(string message, params string[] destinations) { const string illegalCharacters = "\r\n\0"; - if (!destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); + if (destinations == null || !destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); if (illegalCharacters.Any(message.Contains)) throw new ArgumentException("Illegal characters are present in message.", "message"); string to = string.Join(",", destinations); SendRawMessage("PRIVMSG {0} :{1}{2}", to, PrivmsgPrefix, message); @@ -32,22 +32,22 @@ namespace ChatSharp public void SendAction(string message, params string[] destinations) { const string illegalCharacters = "\r\n\0"; - if (!destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); + if (destinations == null || !destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); if (illegalCharacters.Any(message.Contains)) throw new ArgumentException("Illegal characters are present in message.", "message"); string to = string.Join(",", destinations); SendRawMessage("PRIVMSG {0} :\x0001ACTION {1}{2}\x0001", to, PrivmsgPrefix, message); } - /// - /// Sends a NOTICE to one or more destinations (channels or users). + /// + /// Sends a NOTICE to one or more destinations (channels or users). /// - public void SendNotice(string message, params string[] destinations) - { - const string illegalCharacters = "\r\n\0"; - if (!destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); - if (illegalCharacters.Any(message.Contains)) throw new ArgumentException("Illegal characters are present in mesasge.", "message"); - string to = string.Join(",", destinations); - SendRawMessage("NOTICE {0} :{1}{2}", to, PrivmsgPrefix, message); + public void SendNotice(string message, params string[] destinations) + { + const string illegalCharacters = "\r\n\0"; + if (destinations == null || !destinations.Any()) throw new InvalidOperationException("Message must have at least one target."); + if (illegalCharacters.Any(message.Contains)) throw new ArgumentException("Illegal characters are present in message.", "message"); + string to = string.Join(",", destinations); + SendRawMessage("NOTICE {0} :{1}{2}", to, PrivmsgPrefix, message); } ///