Browse Source

check for server==null in User.ServerPermissions getter

pull/44/head
Pat Murphy 9 years ago
parent
commit
0361f2e2d6
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      src/Discord.Net/Models/User.cs

+ 10
- 1
src/Discord.Net/Models/User.cs View File

@@ -268,7 +268,16 @@ namespace Discord
}

#region Permissions
public ServerPermissions ServerPermissions => Server.GetPermissions(this);
public ServerPermissions ServerPermissions
{
get
{
if (Server == null) throw new InvalidOperationException("Unable to get server permissions from a private channel");

return Server.GetPermissions(this);
}
}

public ChannelPermissions GetPermissions(Channel channel)
{
if (channel == null) throw new ArgumentNullException(nameof(channel));


Loading…
Cancel
Save