Browse Source

Add null checks to ModuleManager.EnableServers and EnableChannels

tags/docs-0.9
RogueException 9 years ago
parent
commit
de831001b5
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/Discord.Net.Modules/ModuleManager.cs

+ 2
- 0
src/Discord.Net.Modules/ModuleManager.cs View File

@@ -132,6 +132,7 @@ namespace Discord.Modules
public void EnableServers(IEnumerable<Server> 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<Channel> 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)


Loading…
Cancel
Save