Skip to content

Commit

Permalink
Fixed Null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Jul 6, 2018
1 parent 224fc81 commit 3443ed9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/src/objects/message/Message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ class Message {
this.channel.lastMessageID = this.id;

/// Safe cast to [GuildChannel]
if (this.channel is GuildChannel) {
this.guild = (this.channel as GuildChannel).guild;
if (this.channel is TextChannel) {
this.guild = (this.channel as TextChannel).guild;
this.member = guild.members[this.author.id];

this.roleMentions = new Map<String, Role>();
raw['mention_roles'].forEach((String o) {
this.roleMentions[guild.roles[o].id.toString()] = guild.roles[o];
});
if(raw['mention_roles'] != null) {
this.roleMentions = new Map<String, Role>();
raw['mention_roles'].forEach((String o) {
this.roleMentions[guild.roles[o].id.toString()] = guild.roles[o];
});
}
}

if (raw['edited_timestamp'] != null) {
Expand Down

0 comments on commit 3443ed9

Please sign in to comment.