Browse Source

Merge pull request #44 from moiph/master

check for server==null in User.ServerPermissions getter
pull/49/head
RogueException 9 years ago
parent
commit
87c9d2243b
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