Skip to content

Commit

Permalink
fix: GetMentions NRE
Browse files Browse the repository at this point in the history
Signed-off-by: Lala Sabathil <[email protected]>
  • Loading branch information
Lulalaby authored Jan 24, 2024
1 parent 60faac6 commit 7582112
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions DisCatSharp/Entities/Message/DiscordMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,20 @@ private List<IMention> GetMentions()
{
var mentions = new List<IMention>();

if (this.ReferencedMessage != null && this.MentionedUsersInternal.Contains(this.ReferencedMessage.Author))
mentions.Add(new RepliedUserMention());
try
{
if (this.ReferencedMessage is not null && this.MentionedUsersInternal && this.MentionedUsersInternal.Contains(this.ReferencedMessage.Author))

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library (ubuntu-latest)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Build library and release internally

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'

Check failure on line 483 in DisCatSharp/Entities/Message/DiscordMessage.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Operator '&&' cannot be applied to operands of type 'bool' and 'List<DiscordUser>'
mentions.Add(new RepliedUserMention());

if (this.MentionedUsersInternal.Count != 0)
mentions.AddRange(this.MentionedUsersInternal.Select(m => (IMention)new UserMention(m)));

if (this.MentionedRoleIds.Count != 0)
mentions.AddRange(this.MentionedRoleIds.Select(r => (IMention)new RoleMention(r)));
if (this.MentionedUsersInternal.Count != 0)
mentions.AddRange(this.MentionedUsersInternal.Select(m => (IMention)new UserMention(m)));

if (this.MentionedRoleIds.Count != 0)
mentions.AddRange(this.MentionedRoleIds.Select(r => (IMention)new RoleMention(r)));
}
catch
{ }

return mentions;
}

Expand Down

0 comments on commit 7582112

Please sign in to comment.