From de831001b5852c6c1ba0d709fd923740faf4ffda Mon Sep 17 00:00:00 2001 From: RogueException Date: Tue, 1 Dec 2015 15:07:01 -0400 Subject: [PATCH] Add null checks to ModuleManager.EnableServers and EnableChannels --- src/Discord.Net.Modules/ModuleManager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Discord.Net.Modules/ModuleManager.cs b/src/Discord.Net.Modules/ModuleManager.cs index b25e75e69..afb361e02 100644 --- a/src/Discord.Net.Modules/ModuleManager.cs +++ b/src/Discord.Net.Modules/ModuleManager.cs @@ -132,6 +132,7 @@ namespace Discord.Modules public void EnableServers(IEnumerable servers) { if (servers == null) throw new ArgumentNullException(nameof(servers)); + if (servers.Contains(null)) throw new ArgumentException("Collection cannot contain null.", nameof(servers)); if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist."); lock (this) @@ -194,6 +195,7 @@ namespace Discord.Modules public void EnableChannels(IEnumerable channels) { if (channels == null) throw new ArgumentNullException(nameof(channels)); + if (channels.Contains(null)) throw new ArgumentException("Collection cannot contain null.", nameof(channels)); if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist."); lock (this)