Fix NullReferenceException in ValidateProviderChannelTypes()

This commit is contained in:
Cyberboss
2018-09-21 10:40:33 -04:00
parent bbdd3f805c
commit db30c6cf56
+2 -2
View File
@@ -21,9 +21,9 @@ namespace Tgstation.Server.Api.Models
switch (Provider)
{
case ChatProvider.Discord:
return Channels.Select(x => x.DiscordChannelId.HasValue && x.IrcChannel == null).All(x => x);
return Channels?.Select(x => x.DiscordChannelId.HasValue && x.IrcChannel == null).All(x => x) ?? true;
case ChatProvider.Irc:
return Channels.Select(x => !x.DiscordChannelId.HasValue && x.IrcChannel != null).All(x => x);
return Channels?.Select(x => !x.DiscordChannelId.HasValue && x.IrcChannel != null).All(x => x) ?? true;
default:
throw new InvalidOperationException("Invalid provider type!");
}