Add an extra null check to Channel.GetUser when permission cache is disabled

This commit is contained in:
RogueException
2015-12-23 14:11:23 -04:00
parent e3b5cf3a71
commit 8429a52bc5

View File

@@ -563,13 +563,25 @@ namespace Discord
public User GetUser(ulong id)
{
if (!Client.Config.UsePermissionsCache)
{
if (Server != null)
{
var user = Server.GetUser(id);
if (user != null)
{
ChannelPermissions perms = new ChannelPermissions();
UpdatePermissions(user, perms);
if (perms.ReadMessages)
return user;
}
}
else
{
if (id == Recipient.Id)
return Recipient;
else if (id == Client.PrivateUser.Id)
return Client.PrivateUser;
}
return null;
}