Browse Source

fix: Possible NRE in Sanitize

pull/2290/head
Paulo GitHub 3 years ago
parent
commit
c6459e8bfe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/Discord.Net.Core/Format.cs

+ 3
- 2
src/Discord.Net.Core/Format.cs View File

@@ -37,8 +37,9 @@ namespace Discord
/// <summary> Sanitizes the string, safely escaping any Markdown sequences. </summary>
public static string Sanitize(string text)
{
foreach (string unsafeChar in SensitiveCharacters)
text = text.Replace(unsafeChar, $"\\{unsafeChar}");
if (text != null)
foreach (string unsafeChar in SensitiveCharacters)
text = text.Replace(unsafeChar, $"\\{unsafeChar}");
return text;
}



Loading…
Cancel
Save