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)