Complete DisableServer crash workaround

This commit is contained in:
RogueException
2015-12-26 00:58:22 -04:00
parent bb682936cd
commit 53cf815d1a

View File

@@ -152,7 +152,7 @@ namespace Discord.Modules
public bool DisableServer(Server server) public bool DisableServer(Server server)
{ {
if (server == null) throw new ArgumentNullException(nameof(server)); if (server == null) throw new ArgumentNullException(nameof(server));
//if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist."); if (!_useServerWhitelist) return false;
lock (this) lock (this)
{ {
@@ -168,8 +168,9 @@ namespace Discord.Modules
public void DisableAllServers() public void DisableAllServers()
{ {
if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist."); if (!_useServerWhitelist) throw new InvalidOperationException("This module is not configured to use a server whitelist.");
if (!_useServerWhitelist) return;
lock (this) lock (this)
{ {
if (ServerDisabled != null) if (ServerDisabled != null)
{ {
@@ -223,7 +224,7 @@ namespace Discord.Modules
public bool DisableChannel(Channel channel) public bool DisableChannel(Channel channel)
{ {
if (channel == null) throw new ArgumentNullException(nameof(channel)); if (channel == null) throw new ArgumentNullException(nameof(channel));
if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist."); if (!_useChannelWhitelist) return false;
lock (this) lock (this)
{ {
@@ -250,7 +251,7 @@ namespace Discord.Modules
} }
public void DisableAllChannels() public void DisableAllChannels()
{ {
if (!_useChannelWhitelist) throw new InvalidOperationException("This module is not configured to use a channel whitelist."); if (!_useChannelWhitelist) return;
lock (this) lock (this)
{ {